Johan Förberg every:
That's interesting. Are there any more numbered pseudofiles? I suppose
its mainly an excellent way to confuse people when you open(0).read(),
but it would be interesting to know.

All opened files (and on Unix even network sockets, epoll queues, inotify handlers etc) have a number. It's called a file descriptor. By default stdin, stdout and stderr have the file descriptors 0, 1 and 2. The concept of file descriptors is much older than Python and not Python specific. Even shells use the numbers, e.g. "cmd >logfile 2>&1" means "write stdout to logfile, redirect and combine stderr stream with stdout".

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to