Old Man Yells At Cloud

Rick Johnson rantingrickjohnson at gmail.com
Tue Sep 19 21:43:43 EDT 2017


On Tuesday, September 19, 2017 at 12:55:14 PM UTC-5, Chris Angelico wrote:
> On Wed, Sep 20, 2017 at 3:44 AM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> > Steve D'Aprano <steve+python at pearwood.info> did *not* write
> > [it was edited/abbreviated by me - S. R.]:
> > |disadvantages:
> > |0 - it makes print a special thing

No more "special" than any other reserved word in Python.

> > |1 - beginners have to unlearn

Only if they decide to move to Python3 *AND* only if they
decide to use the print function at _all_. Not everyone uses
print (function or statement). Many folks prefer the power
of the logging module, or use the implicit output of a
REPL.

> > |2 - `print(x, y)` is *not* the same as `print x, y`;

Well, duh! 

> > |3 - it has bizarre syntax that nobody would find normal

Only in advanced usage, which can be better handled by using
sys.stdout.write(...)

> > |4 - you can't pass keyword arguments

Only in advanced cases do you need to. In those cases, wrap
sys.stdout.write with your own function:
    
    # PYTHON 2.x
    >>> import sys
    >>> def myPrintFunc(*args, **kw):
    ...     sys.stdout.write(' '.join(str(arg) for arg in args))
    ...     
    >>>  myPrintFunc("Monkey", "Patching", "is easy", 2, "do!")
    Monkey Patching is easy 2 do!
    
I'll leave the remaining feature implementations as an
exercise for the reader...

> > |5 - it can't be mocked, shadowed, monkey-patched or replaced for testing;

So wrap sys.stdout.write with your own function and then
mock it until it crys and runs home to mommy; shadow it
until it reports you as a stalker; and monkey patch it until
your sewing hand becomes racked with arthritic pain!

> > |6 - and you can't even write help(print) in the interactive interpreter

Hmm, neither can you get help for these:

    # PYTHON 2.x
    >>> help(del)
    SyntaxError: invalid syntax
    >>> help(if)
    SyntaxError: invalid syntax
    >>> help(else)
    SyntaxError: invalid syntax    
    >>> help(for)
    SyntaxError: invalid syntax
    >>> help(class)
    SyntaxError: invalid syntax
    >>> help(def)
    SyntaxError: invalid syntax
    
And this doesn't work either:

    >>> help(python)
    Traceback (most recent call last):
      File "<pyshell#0>", line 1, in <module>
        help(python)
    NameError: name 'python' is not defined
    
nor this:
    
    >>> help(BDFL)
    Traceback (most recent call last):
      File "<pyshell#5>", line 1, in <module>
        help(BDFL)
    NameError: name 'BDFL' is not defined
    
nor even this:

    >>> help("I've fallen and i can't get up!")
    no Python documentation found for "I've fallen and i can't get up!"

Why, what a surprise!!!

These so-called "disadvantages" are nothing but absurdities
masquerading as debate, and more evidence that Steven, along
with Chris, are on a Python3 religious crusade to rid the
world of perceived infidels. 



More information about the Python-list mailing list