why won't slicing lists raise IndexError?
Rick Johnson
rantingrickjohnson at gmail.com
Wed Dec 6 19:05:42 EST 2017
Python wrote:
[...]
> THIS IS FALSE. CALLING A FUNCTION
What *FUNCTION*?
You think you can just slap a function-y looking symbol
willy-nilly in the middle of a chunk of code and then have
it "magically" transform into a python function object?
>>> do_without_item()
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
do_without_item()
NameError: name 'do_without_item' is not defined
>>> foo()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
foo()
NameError: name 'foo' is not defined
>>> bar()
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
bar()
NameError: name 'bar' is not defined
if "do_without_item()" had been defined, then you could call
it a function. But until you do, it's just a NameError.
More information about the Python-list
mailing list