from future import pass_function
phihag at phihag.de
Wed Jul 25 12:30:01 CEST 2012
Unlike the print statement, pass has no overboarding complexity (like
>>, printing tuples, etc.) - it just serves as a marker (and
practicality beats purity).
And you don't ever want to use pass as a value (say, for map() or the
right side of an assignment). In fact, if pass were a function, users
could construct strange code like
x = pass()
raise Exception('Are you slacking off? Get back to work!')
And don't forget that while the parentheses mainly confuse users,
they're also making it harder to type, and feel like useless overhead
(similar to the parentheses in if (x): ). In fact, I'd argue that if
pass were a function, None would be the better placeholder:
None # 2 hard-to-type (on a German keyboard) characters shorter
# (and probably way faster: No function call overhead and no need
# to actually find out what pass happens to be in this context)
On 07/25/2012 10:40 AM, Ulrich Eckhardt wrote:
> I just had an idea, it occurred to me that the pass statement is pretty
> similar to the print statement, and similarly to the print() function,
> there could be a pass() function that does and returns nothing.
> def pass():
> One thing I don't like about this is the syntax
> class foo(object):
> What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: OpenPGP digital signature
More information about the Python-list