how to get the ordinal number in list

Chris Angelico rosuav at gmail.com
Sun Aug 10 15:20:45 EDT 2014


On Mon, Aug 11, 2014 at 5:14 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> In computing, assignment and reassignment aren't at all problematic,
>> and neither is printing to the console, so please stop telling people
>> off for using them.
>
> Printing to the console is somewhat problematic:
>
>    >>> with open("/dev/console", "w") as console: console.write("hello\n")
>    ...
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in <module>
>    IOError: [Errno 13] Permission denied: '/dev/console'

Har har :) I meant printing to the single most obvious destination,
which is a combination of stdout and stderr (the latter for error
tracebacks, by default).

What he's saying is basically "print is EVIL, so do everything with
the REPL, and pretend that the P in REPL doesn't stand for print".
Apparently the idea that code should work from a .py file is foreign
to him.

ChrisA



More information about the Python-list mailing list