mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 05:57:16 +02: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
|
|
@ -106,10 +106,10 @@ An example of making an asynchronous call from inside a [Command](../Components/
|
|||
return final_value
|
||||
|
||||
def at_return_function(r):
|
||||
self.caller.msg("The final value is %s" % r)
|
||||
self.caller.msg(f"The final value is {r}")
|
||||
|
||||
def at_err_function(e):
|
||||
self.caller.msg("There was an error: %s" % e)
|
||||
self.caller.msg(f"There was an error: {e}")
|
||||
|
||||
# do the async call, setting all callbacks
|
||||
utils.run_async(long_running_function, at_return=at_return_function,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ This is how it looks:
|
|||
if not MYPROC_ENABLED:
|
||||
return
|
||||
# output to list this with the other services at startup
|
||||
print(" myproc: %s" % MY_PORT)
|
||||
print(f" myproc: {MY_PORT}")
|
||||
|
||||
# some setup (simple example)
|
||||
factory = MyOwnFactory()
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ Here are some examples
|
|||
|
||||
```python
|
||||
msg("Hello!") # using the 'text' outputfunc
|
||||
msg(prompt="HP:%i, SP: %i, MP: %i" % (HP, SP, MP))
|
||||
msg(prompt=f"HP: {HP}, SP: {SP}, MP: {MP}")
|
||||
msg(mycommand=((1,2,3,4), {"foo": "bar"})
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue