irb(main):001:0> a = 1
=> 1
irb(main):002:0> class Integer
irb(main):003:1> def hello
irb(main):004:2> puts "world"
irb(main):005:2> end
irb(main):006:1> end
=> :hello
irb(main):007:0> a.hello
world
=> nil >>> x = 1
>>> f"{x}"
'1'
This is much more readable than: >>> "{x}".format(x=x)
'1'
>>> "{}".format(x)
'1'
It makes the code immensely more readable than having to count parameters, especially for long strings with a lot of data in them.
Counting is for computers, not programmers; I shouldn't have to count anything for such a trivial task. >>> exec("def f(" + ",".join("f" + str(x) for x in range(300)) + "): print(f299)")
>>> f(*range(300))
299
>>> exec("f(" + ", ".join(str(i) for i in range(300)) + ")")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
SyntaxError: more than 255 arguments
When reducing the number of parameters to be invalid for f, the following error is shown: >>> exec("f(" + ", ".join(str(i) for i in range(30)) + ")")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
TypeError: f() takes exactly 300 arguments (30 given)
Which seems a bit paradoxical - "You need 300 arguments" - "No, wait, actually, you can't have more than 255" ... ;)
Prompt:
"What?"
"What?"
"What?"
"What?"
"What?"
"What?"
"What?"
Response:
Same
I suppose it's kind of GPT's game of life :)