Re: any plans to make pprint() a builtin?
Ant wrote: Longer, messy, and what's the actual point? Wouldn't: import pprint as pp pp.pprint(x) be better, standard *and* shorter? why not just: from pprint import pprint pprint (x) No need to modify the interpreter when you can pollute the global namespace yourself just as easily. -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Considering that the current: import pprint pprint.pprint(x) is hardly lengthy, I can't see how either of the alternatives proposed are any better. python.pprint.pprint(x) 6 characters shorter, but considerably more keystrokes if you are using pprint more than once. Is it worth adding the 'python' builtin to save an import statement? import py py.std.pprint.pprint(x) Longer, messy, and what's the actual point? Wouldn't: import pprint as pp pp.pprint(x) be better, standard *and* shorter? -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Ant wrote: Considering that the current: import pprint pprint.pprint(x) is hardly lengthy, I can't see how either of the alternatives proposed are any better. python.pprint.pprint(x) 6 characters shorter, but considerably more keystrokes if you are using pprint more than once. Is it worth adding the 'python' builtin to save an import statement? import py py.std.pprint.pprint(x) Longer, messy, and what's the actual point? Wouldn't: import pprint as pp pp.pprint(x) be better, standard *and* shorter? I guess the idea is that you can use the import py statement to access many other modules as well, without importing them all separately. -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
John Salerno wrote: Just wondering if this will ever happen, maybe in 3.0 when print becomes a function too? It would be a nice option to have it available without importing it every time, but maybe making it a builtin violates some kind of pythonic ideal? There are so many things which *could* be builtins, and it really is better not to pollute the global namespace with more than absolutely necessary. Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Duncan Booth wrote: John Salerno wrote: Just wondering if this will ever happen, maybe in 3.0 when print becomes a function too? It would be a nice option to have it available without importing it every time, but maybe making it a builtin violates some kind of pythonic ideal? There are so many things which *could* be builtins, and it really is better not to pollute the global namespace with more than absolutely necessary. Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) I think that's what the py.lib people have done with their py.std module: http://codespeak.net/py/current/doc/misc.html#the-py-std-hook (At least, it looks like it; I've never used it myself). TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Duncan Booth wrote: Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) Would you settle for import py py.std.pprint.pprint(x) ? http://codespeak.net/py/current/doc/misc.html#the-py-std-hook Kent -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Tim Golden wrote: Duncan Booth wrote: Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) I think that's what the py.lib people have done with their py.std module: http://codespeak.net/py/current/doc/misc.html#the-py-std-hook (At least, it looks like it; I've never used it myself). Yes, I know it is easy enough to implement. I'm just suggesting that it might be useful as a builtin. After all, if I have to import something to use it I'd mostly just do the imports I needed instead. -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
Kent Johnson wrote: Duncan Booth wrote: Personally I'd just like to see 'python' a builtin shorthand for importing a name you aren't going to use much e.g. python.pprint.pprint(x) Would you settle for import py py.std.pprint.pprint(x) ? http://codespeak.net/py/current/doc/misc.html#the-py-std-hook Kent Interesting, but that could start to get a little too messy I think. I'd rather just have the 'authentic' code in my program (i.e. pprint.pprint) instead of the py.std prefix as well. It's a good point not to pollute the builtin namespace with too much, so I think I'd rather just import pprint when needed instead of using the py.std call. -- http://mail.python.org/mailman/listinfo/python-list
Re: any plans to make pprint() a builtin?
It has been proposed to replace the current print statement with a print function for python 3.0. http://www.python.org/dev/peps/pep-3100/ From BDFL state of the python union: print x, y, x becomes print(x, y, z) print f, x, y, z becomes print(x, y, z, file=f) -- http://mail.python.org/mailman/listinfo/python-list
any plans to make pprint() a builtin?
Just wondering if this will ever happen, maybe in 3.0 when print becomes a function too? It would be a nice option to have it available without importing it every time, but maybe making it a builtin violates some kind of pythonic ideal? -- http://mail.python.org/mailman/listinfo/python-list