Buffering control in python?
Fernando Pérez
fperez528 at yahoo.com
Sat Oct 12 16:31:08 EDT 2002
More information about the Python-list mailing list
Sat Oct 12 16:31:08 EDT 2002
- Previous message (by thread): Buffering control in python?
- Next message (by thread): Buffering control in python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I know that using -u will turn buffering off for everything in python. But is there a good reason for the lack of a way to turn buffering off from _inside_ a script? It's a bit nonsensical --at least from a user's perspective-- that something which can be done at the command line so easily isn't available inside the language itself. I don't want to use #!/usr/bin/python -u because of its portability problems. In Perl each stream can be set to unbuffered via a simple STDOUT->autoflush(1); Any reason why something like sys.stdout.autoflush(1) wouldn't be a good thing? I hate having to put sys.stdout.flush() calls all over the place when I need unbuffered output, when a stateful approach would be far cleaner. It would be also better than a blanket '-u' switch, since one could turn buffering off only for those streams that need it, and only in the places where it's needed. Any comments from the cognoscenti? Thanks, f.
- Previous message (by thread): Buffering control in python?
- Next message (by thread): Buffering control in python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list