Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think I follow the stderr comment. Isn't it just:

Perl

    print STDERR "foo"
Python

    print(file=sys.stderr, "foo")
Those look fairly similar. I prefer that print() is obviously a function call and file is a named parameter so the purpose is clear.


Well in Perl there is...

warn("foo")

In Python you have to at least:

- remember not to forget to import sys - remember the file= syntax for the print statement - type about 10 extra characters

Bunch of annoying stuff when you are hurriedly debugging something...


The file=sys.stderr came with Python 3. Because of that, I tend to see sys.stderr.write("foo\n") more often.


Python 2 was even more terse with it's print statement

    print >>sys.stderr, "foo"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: