mirror of
https://github.com/evennia/evennia.git
synced 2026-04-06 16:44:08 +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
|
|
@ -65,7 +65,7 @@ Here is a minimalistic command with no custom parsing:
|
|||
|
||||
def func(self):
|
||||
# echo the caller's input back to the caller
|
||||
self.caller.msg("Echo: {}".format(self.args)
|
||||
self.caller.msg(f"Echo: {self.args}")
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -548,7 +548,7 @@ class CmdTestID(Command):
|
|||
self.xval = 0
|
||||
self.xval += 1
|
||||
|
||||
self.caller.msg("Command memory ID: {} (xval={})".format(id(self), self.xval))
|
||||
self.caller.msg(f"Command memory ID: {id(self)} (xval={self.xval})")
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ thus do so asynchronously, using callbacks.
|
|||
```python
|
||||
# in command class func()
|
||||
def callback(ret, caller):
|
||||
caller.msg("Returned is %s" % ret)
|
||||
caller.msg(f"Returned is {ret}")
|
||||
deferred = self.execute_command("longrunning")
|
||||
deferred.addCallback(callback, self.caller)
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue