Re: Why does not pprint work?

2014-08-03 Thread Mark Lawrence
On 03/08/2014 22:34, robkote...@gmail.com wrote: [snipped to bits] Please don't top post, further would you read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pythonistas, ask not what

Re: Why does not pprint work?

2014-08-03 Thread robkotenko
With the way you have imported, you trying to use the module pprint instead of the function pprint.pprint. You need to use pprint.pprint or you need to import as: from pprint import pprint if you want to use the shorter form. On Tuesday, July 22, 2014 5:42:02 PM UTC-4, fl wrote: >

Re: Why does not pprint work?

2014-07-22 Thread Chris Angelico
On Wed, Jul 23, 2014 at 12:26 PM, Ned Batchelder wrote: >> Ned, if you're reading this: Adding the import would make the post >> clearer. :) > > > Done. Thanks Ned! ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does not pprint work?

2014-07-22 Thread Ned Batchelder
On 7/22/14 5:49 PM, Chris Angelico wrote: On Wed, Jul 23, 2014 at 7:42 AM, fl wrote: I enter the example lines of that website: import pprint board = [ [0]*8 ] * 8 pprint(board) Flaw in the blog post: he didn't actually specify the import line. What you actually want is this: from p

Re: Why does not pprint work?

2014-07-22 Thread Chris Kaynor
On Tue, Jul 22, 2014 at 3:17 PM, emile wrote: > Then, how can I list all the function of pprint? >> > > use the dir builtin: > > >>> dir (pprint) > ['PrettyPrinter', '_StringIO', '__all__', '__builtins__', 

Re: Why does not pprint work?

2014-07-22 Thread Chris Angelico
On Wed, Jul 23, 2014 at 8:05 AM, fl wrote: > On Tuesday, July 22, 2014 5:51:07 PM UTC-4, emile wrote: >> On 07/22/2014 02:42 PM, fl wrote: >> pprint is a module name -- you need to invoke the pprint function from >> within the pprint module: >> pprint.pprint(board) >

Re: Why does not pprint work?

2014-07-22 Thread emile
On 07/22/2014 03:05 PM, fl wrote: On Tuesday, July 22, 2014 5:51:07 PM UTC-4, emile wrote: On 07/22/2014 02:42 PM, fl wrote: pprint is a module name -- you need to invoke the pprint function from within the pprint module: pprint.pprint(board) Thanks. I am curious about the two pprint. Is it

Re: Why does not pprint work?

2014-07-22 Thread fl
On Tuesday, July 22, 2014 5:51:07 PM UTC-4, emile wrote: > On 07/22/2014 02:42 PM, fl wrote: > pprint is a module name -- you need to invoke the pprint function from > within the pprint module: > pprint.pprint(board) Thanks. I am curious about the two pprint. Is it the first pprint

Re: Why does not pprint work?

2014-07-22 Thread emile
On 07/22/2014 02:42 PM, fl wrote: Hi, I read web tutorial at: http://nedbatchelder.com/blog/201308/names_and_values_making_a_game_board.html I enter the example lines of that website: import pprint board = [ [0]*8 ] * 8 pprint(board) pprint is a module name -- you need to invoke the

Re: Why does not pprint work?

2014-07-22 Thread Chris Angelico
On Wed, Jul 23, 2014 at 7:42 AM, fl wrote: > I enter the example lines of that website: > > > import pprint > board = [ [0]*8 ] * 8 > pprint(board) Flaw in the blog post: he didn't actually specify the import line. What you actually want is this: from pprint import pprin

Why does not pprint work?

2014-07-22 Thread fl
Hi, I read web tutorial at: http://nedbatchelder.com/blog/201308/names_and_values_making_a_game_board.html I enter the example lines of that website: import pprint board = [ [0]*8 ] * 8 pprint(board) It echos error with Python 2.7: Traceback (most recent call last): File "C:\Pyt

Re: pprint defaultdict one record per line

2013-03-17 Thread Terry Reedy
On 3/17/2013 1:45 PM, Peng Yu wrote: pprint can not print defaultdict one record per line Known issue, no progress for 2+ years. Patch not updated for default branch (3.4). Not clear what best way forward is. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: pprint defaultdict one record per line

2013-03-17 Thread Mark Lawrence
On 17/03/2013 17:45, Peng Yu wrote: Hi, pprint can not print defaultdict one record per line. Is there some other convenient way in python to print one record per line? ~/linux/test/python/man/library/pprint/function/pprint$ ./main.py {'two': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,

pprint defaultdict one record per line

2013-03-17 Thread Peng Yu
Hi, pprint can not print defaultdict one record per line. Is there some other convenient way in python to print one record per line? ~/linux/test/python/man/library/pprint/function/pprint$ ./main.py {'two': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 'one': [0, 1, 2,

Re: pprint

2010-06-09 Thread Rodrick Brown
On Wed, Jun 9, 2010 at 5:01 AM, madhuri vio wrote: > sir what is the function of pprint??? > could you please help me out with that > > -- > madhuri :) > > rbr...@laptop:~$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type "help&q

pprint

2010-06-09 Thread madhuri vio
sir what is the function of pprint??? could you please help me out with that -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with pprint

2009-11-25 Thread Terry Reedy
Nadav Chernin wrote: Hello, I want to print list of lists in matrix format. So I use pprint with parameter ‘width’ for this target. For example : >>> data=[[1, 1, 1], [1, 1, 1], [1, 1, 1]] >>> pprint(data,width=20) [[1, 1, 1], [1, 1, 1], [1, 1, 1]] The problem tha

Re: Help with pprint

2009-11-25 Thread Emile van Sebille
On 11/25/2009 4:47 AM Nadav Chernin said... Hello, I want to print list of lists in matrix format. So I use pprint with parameter ‘width’ for this target. The problem that I don’t know how to select width value, because if: >>>data=[['one', 'one', 'o

Help with pprint

2009-11-25 Thread Nadav Chernin
Hello, I want to print list of lists in matrix format. So I use pprint with parameter 'width' for this target. For example : >>> data=[[1, 1, 1], [1, 1, 1], [1, 1, 1]] >>> pprint(data,width=20) [[1, 1, 1], [1, 1, 1], [1, 1, 1]] The problem that I do

Re: How do I make pprint do this

2009-05-20 Thread Robert Kern
On 2009-05-20 10:37, s...@pobox.com wrote: >> I cannot get pprint to format output how I would like. pydb does. I >> tried grepping the source but still couldn't grok it. That's not the way pprint works. You have no control over how it arranges its output.

Re: How do I make pprint do this

2009-05-20 Thread skip
>> I cannot get pprint to format output how I would like. pydb does. I >> tried grepping the source but still couldn't grok it. That's not the way pprint works. You have no control over how it arranges its output. If you need something more flexible you&#x

How do I make pprint do this

2009-05-20 Thread jcervidae
I cannot get pprint to format output how I would like. pydb does. I tried grepping the source but still couldn't grok it. Here: (Pydb) a = range(1,100) (Pydb) pp a [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 3

Re: Simple - Pretty Printing (pprint) a list with a max width?

2008-11-07 Thread Paul McGuire
On Nov 7, 9:45 am, rh0dium <[EMAIL PROTECTED]> wrote: > Hi all, > > Perhaps it's not supposed to work like this but I thought if you > supplied a width to pprint it would nicely format a list to the > width. > > KEYS = ['search_keys', 'Section

Simple - Pretty Printing (pprint) a list with a max width?

2008-11-07 Thread rh0dium
Hi all, Perhaps it's not supposed to work like this but I thought if you supplied a width to pprint it would nicely format a list to the width. KEYS = ['search_keys', 'Section', 'site', 'Employee', 'JobClassCode', 'XBoss',

pprint module and newer standard types

2008-04-17 Thread Donald 'Paddy' McCarthy
Hi, When I try and use pprint on standard types I get varying 'quality of output'. Lists will wrap nicely to multiple lines as will dicts, but sets and defaultdicts give one long unreadable line. Is their a chance to get this changed so that more built-in types look pretty when pr

pprint module and newer standard types

2008-04-08 Thread Paddy
Hi, When I try and use pprint on standard types I get varying 'quality of output'. Lists will wrap nicely to multiple lines as will dicts, but sets and defaultdicts give one long unreadable line. Is their a chance to get this changed so that more built-in types look pretty when pr

Re: pprint, __repr__ and inheritance, how does it works?

2008-02-25 Thread Gabriel Genellina
will be to output all the __dict__ > atributes. Using [1] as reference I have come up with the following > but it has 2 problems, first the type call it's not generating valid > python code and second this doesn't seems to work with pprint as it's > just printing the string a

pprint, __repr__ and inheritance, how does it works?

2008-02-25 Thread Jorge Vargas
has 2 problems, first the type call it's not generating valid python code and second this doesn't seems to work with pprint as it's just printing the string as a one-liner making it equivalente as calling repr(obj) from pprint import pprint class node(object): def __init__(self,a,

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread Adam Jones
Brian L. Troutwine wrote: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # something. I wrote this when I was t

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread John Salerno
Brian L. Troutwine wrote: > thank small children who sleep at night. That seems like the kind of sentence that could become a tagline or something, and you just have to be in the know to understand where it comes from. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: pprint: "...thank small children who sleep at night."

2006-09-20 Thread Fredrik Lundh
Brian L. Troutwine wrote: > Is the last sentence an obscure reference or in-joke? Can someone > explain it? I don't get it. do you have small kids? tried doing serious programming while they're still awake? -- http://mail.python.org/mailman/listinfo/python-list

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Steve Holden
Paul McGuire wrote: > "Brian van den Broek" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: >> >>>The heading comment to pprint reads: >>> >>>#

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Paul McGuire
"Brian van den Broek" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: >> The heading comment to pprint reads: >> >> # This is a simple little module I wrote to make life easier.

Re: pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian van den Broek
Brian L. Troutwine said unto the world upon 19/09/06 05:30 PM: > The heading comment to pprint reads: > > # This is a simple little module I wrote to make life easier. I > didn't > # see anything quite like it in the library, though I may have > overlooked > # somet

pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian L. Troutwine
The heading comment to pprint reads: # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descri

Re: any plans to make pprint() a builtin?

2006-05-16 Thread Edward Elliott
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 globa

Re: any plans to make pprint() a builtin?

2006-05-15 Thread John Salerno
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

Re: any plans to make pprint() a builtin?

2006-05-15 Thread Ant
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 ad

Re: any plans to make pprint() a builtin?

2006-05-14 Thread pjw
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/ma

Re: any plans to make pprint() a builtin?

2006-05-14 Thread John Salerno
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?

2006-05-14 Thread Duncan Booth
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://codesp

Re: any plans to make pprint() a builtin?

2006-05-14 Thread Kent Johnson
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

Re: any plans to make pprint() a builtin?

2006-05-14 Thread Tim Golden
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? >

Re: any plans to make pprint() a builtin?

2006-05-14 Thread Duncan Booth
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 whic

any plans to make pprint() a builtin?

2006-05-13 Thread John Salerno
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