[issue6743] pprint.pprint should support no objects to print blank lines & allow args
Mary Stern added the comment: Sorry: you also need to print out the args! :) .. like this: def pprint(object='\n', *args, stream=None, indent=1, width=80, depth=None): """Pretty-print a Python object to a stream [default is sys.stdout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) printer.pprint(object) for arg in args: printer.pprint(arg) -- ___ Python tracker <http://bugs.python.org/issue6743> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6743] pprint.pprint should support no objects to print blank lines & allow args
New submission from Mary Stern : Using print in python 3 I would like to simple "replace" print with pprint.pprint. However pprint cannot be called with no arguments, so this cannot currently be done (the error is "TypeError: pprint() takes at least 1 positional argument (0 given)"). A simple improvement is to allow no object to be passed in and pprint would then print a newline rather than fail. Another problem is that if you try this: print('hello', True) and replace print with print, the second arg gets interpreted as the "stream" parameter. Both of the above can be fixed (I think) by changing pprint.py as follows: instead of the current code: def pprint(object, stream=None, indent=1, width=80, depth=None): change to this: def pprint(object='\n', *args, stream=None, indent=1, width=80, depth=None) -- messages: 91774 nosy: marystern severity: normal status: open title: pprint.pprint should support no objects to print blank lines & allow args type: feature request versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue6743> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5253] os.environ.get() doesn't handle default value
New submission from Mary Stern : os.environ.get('ENV_VAR, 'mydefault') returns '' rather than 'mydefault' if not set. It would be nice if this standard dict-style behavior was supported. -- messages: 81963 nosy: marystern severity: normal status: open title: os.environ.get() doesn't handle default value type: feature request versions: Python 2.5 ___ Python tracker <http://bugs.python.org/issue5253> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)
Changes by Mary Stern : -- title: subprocess.POpen.__del__() AttribuetError (os module == None!) -> subprocess.POpen.__del__() AttributeError (os module == None!) ___ Python tracker <http://bugs.python.org/issue5099> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5099] subprocess.POpen.__del__() AttribuetError (os module == None!)
New submission from Mary Stern : I was getting this error (while running my unit tests): Exception exceptions.AttributeError: "'NoneType' object has no attribute 'error'" in > ignored which I tracked down to the os module being set to None (yes really!) in POpen._internal_poll() when called from Popen.__del__, so this line: except os.error: was generating the error. I guess that the module is getting unloaded earlier somehow (maybe a race condition)? -- components: Extension Modules messages: 80771 nosy: marystern severity: normal status: open title: subprocess.POpen.__del__() AttribuetError (os module == None!) type: crash versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue5099> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com