mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 14:26:30 +01:00
issue #2243 -- prefer f-strings over %-interpolation
edited docs to prefer f-strings, then str.format(), and remove %-interpolation additional ad-hoc documentation fixes, as opportunities seen: - replace Built-In Function (BIF) "min" variable with "mins" - prefer BIF str(var) over "%s" % var - reformat some code examples to clarify multiple args passed to functions - change some single-quote strings to double-quotes for consistency - fix mismatched parens misc edits: - add .vscode/ to gitignore
This commit is contained in:
parent
f45051050e
commit
851ca30be5
30 changed files with 207 additions and 193 deletions
|
|
@ -91,13 +91,12 @@ Below is a version of the example file found in `evennia/contrib/tutorial_exampl
|
|||
table = create_object(Object, key="Blue Table", location=limbo)
|
||||
chair = create_object(Object, key="Blue Chair", location=limbo)
|
||||
|
||||
string = "A %s and %s were created."
|
||||
string = f"A {table} and {chair} were created."
|
||||
if DEBUG:
|
||||
table.delete()
|
||||
chair.delete()
|
||||
string += " Since debug was active, " \
|
||||
"they were deleted again."
|
||||
caller.msg(string % (table, chair))
|
||||
string += " Since debug was active, they were deleted again."
|
||||
caller.msg(string)
|
||||
```
|
||||
|
||||
This uses Evennia's Python API to create three objects in sequence.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue