[issue505152] pprint should (optionally) use str

2022-04-10 Thread admin
Change by admin : -- github: None -> 35939 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue489472] pprint produces unreadable dict output

2022-04-10 Thread admin
Change by admin : -- github: None -> 35669 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue482003] dict display broken in pprint

2022-04-10 Thread admin
Change by admin : -- github: None -> 35531 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue451538] L10n of pprint

2022-04-10 Thread admin
Change by admin : -- github: None -> 34973 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45559] pprint tests do not test pprint.pprint()

2022-02-18 Thread Eric V. Smith
Eric V. Smith added the comment: Sure, have a go at it! Any testing of pprint.pprint() would be an improvement, but ideally all options should be tested. It would probably be worthwhile to restructure the tests to run both pformat and pprint tests from the same logic, so that we only need

[issue45559] pprint tests do not test pprint.pprint()

2022-02-18 Thread Haz
Haz added the comment: Hi! Any chance I could take this on if it hasn't already been actioned please? I assume the scope is to test all the pprint options? Thanks! -- nosy: +hp310780 ___ Python tracker <https://bugs.python.org/issue45

[issue45959] Teach pprint about dict views

2022-01-17 Thread Éric Araujo
Éric Araujo added the comment: The PR looks good! When the last comments are resolved, unless there is activity from other core devs, I will merge it. -- nosy: +eric.araujo ___ Python tracker

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2022-01-03 Thread Irit Katriel
Irit Katriel added the comment: The documentation change in the PR clarifies the current state of things. @serhiy.storchaka - do you have a view on whether we should aim for an actual fix, or just document and close? -- ___ Python tracker

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2021-12-28 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2021-12-25 Thread Andrei Kulakov
Andrei Kulakov added the comment: The recursion protection in `saferepr` applies when two conditions are met: - the structure is subclassed from list, tuple or dict - __repr__ is not overriden In this case neither condition is met. However, the recursion is caused by the `__repr__` so when

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2021-12-25 Thread Andrei Kulakov
Change by Andrei Kulakov : -- keywords: +patch nosy: +andrei.avk nosy_count: 2.0 -> 3.0 pull_requests: +28477 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30256 ___ Python tracker

[issue45959] Teach pprint about dict views

2021-12-16 Thread Daniel Diniz
Daniel Diniz added the comment: I have tried to add this. The PR adds: - PrettyPrinter._pprint_dict_view to handle dict_keys and dict_values (sorted with _safe_key). = PrettyPrinter._pprint_dict_items_view to handle dict_items (sorted using _safe_tuple). - Tests. Would a NEWS entry or other

[issue45959] Teach pprint about dict views

2021-12-16 Thread Daniel Diniz
Change by Daniel Diniz : -- keywords: +patch nosy: +ajaksu2 nosy_count: 4.0 -> 5.0 pull_requests: +28355 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30135 ___ Python tracker

[issue45959] Teach pprint about dict views

2021-12-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: More accurate to say that it aspires to print in a single line ONLY if the content fits in the specified width. Otherwise, it prints vertically with appropriate indentation. Indeed, that is the entire purpose of the module; otherwise, we would just use

[issue45959] Teach pprint about dict views

2021-12-14 Thread Joshua Insel
Joshua Insel added the comment: According to the documentation for pprint, it is supposed to print objects on a single line if possible. See the second paragraph here: https://docs.python.org/3/library/pprint.html -- nosy: +joshinsel ___ Python

[issue45959] Teach pprint about dict views

2021-12-13 Thread David Peled
Change by David Peled : -- nosy: +david-peled ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34798] pprint ignores the compact parameter for dicts

2021-12-11 Thread Irit Katriel
Irit Katriel added the comment: Don't discuss on a closed issue. Create a new one if there is still a problem. -- ___ Python tracker ___

[issue34798] pprint ignores the compact parameter for dicts

2021-12-11 Thread Matt Bogosian
Matt Bogosian added the comment: Please consider highlighting that dicts are not included in the documentation. While *technically* true, this ... > compact impacts the way that long sequences (lists, tuples, sets, etc) are > formatted. If compact is false (the default) then each item of a

[issue45959] Teach pprint about dict views

2021-12-02 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45959] Teach pprint about dict views

2021-12-01 Thread Raymond Hettinger
New submission from Raymond Hettinger : The pprint() code has a number of type or protocol specific handlers but doesn't have one for dict views. So, we don't get pretty printing for the key(), values(), and items(): d = {i:i for i in range(100)} pprint(d) # This is handled

[issue45611] pprint - low width overrides depth folding

2021-10-26 Thread Ian Currie
New submission from Ian Currie : Reproducible example: >>> from pprint import pprint >>> data = [["aa"],[2],[3],[4],[5]] >>> pprint(data) [["aaaaaa"], [2], [3], [4], [5]] >>> pprint(data, depth=1) [[...], [...

[issue34798] pprint ignores the compact parameter for dicts

2021-10-25 Thread Ian
Ian added the comment: I came across this and was confused by it too. I also don't understand the justification with not having dicts to be affected by the `compact` parameter. If the "compact form" is having separate entries or elements on one line, instead of having each element separated

[issue45559] pprint tests do not test pprint.pprint()

2021-10-21 Thread Eric V. Smith
Change by Eric V. Smith : -- title: pprint module does not test pprint.pprint() -> pprint tests do not test pprint.pprint() ___ Python tracker <https://bugs.python.org/issu

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.11 ___ Python tracker ___

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread miss-islington
miss-islington added the comment: New changeset 6b75ad5fd47e5b34a04197927f748d0391898de7 by Miss Islington (bot) in branch '3.10': bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129) https://github.com/python/cpython/commit/6b75ad5fd47e5b34a04197927f748d0391898de7 --

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 087f089e5e04d5b132ffbff0576667d591f13219 by Eric V. Smith in branch 'main': bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129) https://github.com/python/cpython/commit/087f089e5e04d5b132ffbff0576667d591f13219 --

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 2.0 -> 3.0 pull_requests: +27409 pull_request: https://github.com/python/cpython/pull/29133 ___ Python tracker

[issue45559] pprint module does not test pprint.pprint()

2021-10-21 Thread Eric V. Smith
priority: normal severity: normal status: open title: pprint module does not test pprint.pprint() type: behavior versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue45

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +27405 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29129 ___ Python tracker ___

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: It's a bug in pprint.py. PR to follow shortly. -- ___ Python tracker ___ ___ Python-bugs-list

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Eric V. Smith
Eric V. Smith added the comment: Please do not post screen shots. They don't work for people with vision impairments, and we can't copy and past from them, so it makes it harder for us to help you. It looks like it works with pformat, and not pprint: >>> pprint.pfor

[issue45557] pprint -> underscore_numbers argument not working

2021-10-21 Thread Jean-Philippe VINCENT
Change by Jean-Philippe VINCENT : -- title: Issue 42914 -> pprint -> underscore_numbers argument not working ___ Python tracker <https://bugs.python.org/i

[issue42914] pprint numbers with underscore

2021-10-09 Thread Stéphane Blondon
Stéphane Blondon added the comment: Ok, I will not send a PR to change the current behavior until python4 (in case it exists one day). -- ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-10-05 Thread Eric V. Smith
Eric V. Smith added the comment: The safest thing to do is never make it the default. It would always be an opt-in behavior. -- ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-10-05 Thread Stéphane Blondon
Stéphane Blondon added the comment: Python 3.10 has now been released with the underscore_numbers parameter. I wonder which release could enable the parameter by default (so it would break the previous behavior): - the next release (3.11) is probably too short. - the safest strategy is to

[issue41546] pprint() gives exception when ran from pythonw

2021-07-19 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue41546] pprint() gives exception when ran from pythonw

2021-07-19 Thread Irit Katriel
Irit Katriel added the comment: New changeset aab1899c9d79083c1ff31d974ed8b562d3ca3b5d by Irit Katriel in branch 'main': bpo-41546: make pprint (like print) not write to stdout when it is None (GH-26810) https://github.com/python/cpython/commit/aab1899c9d79083c1ff31d974ed8b562d3ca3b5d

[issue44580] pprint does not work for typing.Mapping

2021-07-07 Thread Hayden Clark
New submission from Hayden Clark : If you make a user-defined type that inherits from typing.Mapping (which is an alias for collections.abc.Mapping), pprint does not dump the contents, it just treats it as an unknown class. Examining the code, it is explicitly checking for "dict"

[issue44580] pprint does not work for typing.Mapping

2021-07-07 Thread Hayden Clark
Change by Hayden Clark : -- components: Library (Lib) nosy: hclark priority: normal severity: normal status: open title: pprint does not work for typing.Mapping type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- versions: -Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 42c26282a123d14591e1aa31107e566b302a19ac by Miss Islington (bot) in branch '3.10': bpo-34798: [doc] clearer presentation of pprint.PrettyPrinter constru… (GH-26967) (GH-26990)

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset 943e77d42d3f84b581f32c05f1fc8c05366b8ed3 by Irit Katriel in branch 'main': bpo-34798: [doc] clearer presentation of pprint.PrettyPrinter constru… (GH-26967) https://github.com/python/cpython/commit/943e77d42d3f84b581f32c05f1fc8c05366b8ed3

[issue34798] pprint ignores the compact parameter for dicts

2021-07-02 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 5.0 -> 6.0 pull_requests: +25552 pull_request: https://github.com/python/cpython/pull/26990 ___ Python tracker

[issue34798] pprint ignores the compact parameter for dicts

2021-06-30 Thread Irit Katriel
Irit Katriel added the comment: I made PR26967 to break up the paragraph about the constructor params so that it's easier to read, and also added emphasis around the "sequence" point. -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

[issue34798] pprint ignores the compact parameter for dicts

2021-06-30 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +25531 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26967 ___ Python tracker ___

[issue41546] pprint() gives exception when ran from pythonw

2021-06-20 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.11 -Python 3.10 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue41546] pprint() gives exception when ran from pythonw

2021-06-20 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch nosy: +iritkatriel nosy_count: 9.0 -> 10.0 pull_requests: +25392 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26810 ___ Python tracker

[issue42914] pprint numbers with underscore

2021-06-02 Thread miss-islington
miss-islington added the comment: New changeset 41317801a95c758c3fc04c4fb332ac453c9e3ad3 by Miss Islington (bot) in branch '3.10': Add bpo-42914 to What's New (GH-25124) https://github.com/python/cpython/commit/41317801a95c758c3fc04c4fb332ac453c9e3ad3 --

[issue42914] pprint numbers with underscore

2021-06-02 Thread miss-islington
miss-islington added the comment: New changeset 4846ea95d1a121df5e8081e2a290f63d1419cad8 by Wm. Keith van der Meulen in branch 'main': Add bpo-42914 to What's New (GH-25124) https://github.com/python/cpython/commit/4846ea95d1a121df5e8081e2a290f63d1419cad8 -- nosy: +miss-islington

[issue42914] pprint numbers with underscore

2021-06-02 Thread miss-islington
Change by miss-islington : -- pull_requests: +25105 pull_request: https://github.com/python/cpython/pull/26509 ___ Python tracker ___

[issue43080] pprint for dataclass instances

2021-04-13 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks for all of the work, LewisGaul. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue43080] pprint for dataclass instances

2021-04-13 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset 11159d2c9d6616497ef4cc62953a5c3cc8454afb by Lewis Gaul in branch 'master': bpo-43080: pprint for dataclass instances (GH-24389) https://github.com/python/cpython/commit/11159d2c9d6616497ef4cc62953a5c3cc8454afb

[issue42914] pprint numbers with underscore

2021-03-31 Thread Wm. Keith van der Meulen
Change by Wm. Keith van der Meulen : -- nosy: +wkeithvan nosy_count: 7.0 -> 8.0 pull_requests: +23872 pull_request: https://github.com/python/cpython/pull/25124 ___ Python tracker

[issue42914] pprint numbers with underscore

2021-03-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: Thanks for the contribution Stéphane! I agree that this would be a nice default. We're just being conservative in the pace of default behavior changes. Changing the default could be considered in the future after a few releases with this parameter have

[issue42914] pprint numbers with underscore

2021-03-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset 3ba3d513b1e3c63d09cb798b982a9e6c369cea4c by sblondon in branch 'master': bpo-42914: add a pprint underscore_numbers option (GH-24864) https://github.com/python/cpython/commit/3ba3d513b1e3c63d09cb798b982a9e6c369cea4c

[issue42914] pprint numbers with underscore

2021-03-22 Thread Stéphane Blondon
Stéphane Blondon added the comment: I changed the default to be backward compatible (so underscore_numbers=False). I think it would be better with underscore_numbers enabled by default but I understand the need for stability. Perhaps such break could be done in the future (in version 3.12 or

[issue42914] pprint numbers with underscore

2021-03-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think underscores can be on by default. It needs to be opt-in to be backwards compatible. -- ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-03-20 Thread Gregory P. Smith
Change by Gregory P. Smith : -- nosy: +gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43080] pprint for dataclass instances

2021-03-20 Thread Gregory P. Smith
Gregory P. Smith added the comment: +0.5 I lean towards just accepting this under the conditions Eric describes given that dataclass is a stdlib concept and nobody is likely to claim that such output from pprint is a bad thing. The larger "some form of protocol for pprint to work o

[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Closing then. I'll just add my implementation in my .pythonrc.py. -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list

[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg291198 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue43080] pprint for dataclass instances

2021-03-16 Thread Lewis Gaul
Lewis Gaul added the comment: > FWIW, we've not had a feature request for this ever, nor has there been a > request for pprint to support attrs, nor any other hand-rolled class that > implements methods similar to those generated by dataclasses. I wouldn't expect core Python t

[issue43080] pprint for dataclass instances

2021-03-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, we've not had a feature request for this ever, nor has there been a request for pprint to support attrs, nor any other hand-rolled class that implements methods similar to those generated by dataclasses. AFAICT, this tracker issue wasn't motivated

[issue43080] pprint for dataclass instances

2021-03-15 Thread Eric V. Smith
fields). Under those conditions, I don't see the harm. The reason I'm leaning toward acceptance is that we've talked about a better pprint for ages, and yet there's no activity that I can tell toward developing a replacement in the stdlib. pprint was a motivating example for PEP 443 (singledispatch

[issue42914] pprint numbers with underscore

2021-03-14 Thread Stéphane Blondon
was not defined.) - I thought about adding the same behavior for float too but I didn't add it because the '_f' type uses a precision of 6 digits after the decimal point for float. So it's possible some precision would be lost with the pprint() call. It could mislead users more than helping them

[issue42914] pprint numbers with underscore

2021-03-14 Thread Stéphane Blondon
Change by Stéphane Blondon : -- keywords: +patch pull_requests: +23624 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24864 ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-03-09 Thread Felipe
Felipe added the comment: All yours! I'm tied up so won't be able to submit the PR On Thu, 25 Feb 2021 at 10:12, Stéphane Blondon wrote: > > Stéphane Blondon added the comment: > > I add the same idea but later than you, so I'm interested by such feature. > > Felipe: do you want to add a

[issue42914] pprint numbers with underscore

2021-02-25 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42914] pprint numbers with underscore

2021-02-25 Thread Stéphane Blondon
Stéphane Blondon added the comment: I add the same idea but later than you, so I'm interested by such feature. Felipe: do you want to add a pull request to this issue (with Serhiy Storchaka implementation because it's the simplest one)? If not, I plan to write it. I will write it too if

[issue43080] pprint for dataclass instances

2021-01-31 Thread Eric V. Smith
Eric V. Smith added the comment: I agree that we need a better pprint. I think it would be easier to create something new rather than try and morph the existing pprint, but maybe I lack enough imagination. I'd prefer to use functools.singledispatch instead of a __pprint__ method

[issue43080] pprint for dataclass instances

2021-01-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: At some point, we need a modern redesign alternative to pprint. It could have its own __pprint__ method to communicate how it wants to be pretty printed. Until then, I think the existing pprint module should only grow custom support for classes

[issue43080] pprint for dataclass instances

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good idea Eric, it should work. But it can make the code of pprint potentially less flexible. Currently it uses a mapping which maps __repr__ to corresponding pprint implementation. Only exception is for dicts, for historical reasons. It potentially can

[issue43080] pprint for dataclass instances

2021-01-31 Thread Lewis Gaul
Lewis Gaul added the comment: @Serhiy - Yes, I noted that problem in the PR. Thanks for pointing me to that issue, I agree it would be good to make pprint properly extensible (my current solution is to maintain a fork of the pprint module with dataclass support added). Eric's suggestion

[issue43080] pprint for dataclass instances

2021-01-31 Thread Eric V. Smith
Eric V. Smith added the comment: Adding an attribute on the __repr__ (and other methods?) signifying that they were generated would let us distinguish them. Say, checking getattr(__repr__, '__is_generated__', False), or similar. -- ___ Python

[issue43080] pprint for dataclass instances

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For all other classes we check that there is no user defined __repr__. But it is difficult to check this for dataclass or namedtuple because there is no base class for dataclasses or namedtuples which provides standard __repr__ implementation. All

[issue43080] pprint for dataclass instances

2021-01-31 Thread Lewis Gaul
Lewis Gaul added the comment: > a dataclass can do anything a regular class can do Agreed, but isn't that also true of any subclasses of currently supported types? In particular 'UserDict', 'UserList' and 'UserString', which all have explicit support in pprint and are intended for &quo

[issue43080] pprint for dataclass instances

2021-01-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: Since a dataclass can do anything a regular class can do, it is probably too general to have a special case for pprint. -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker <https://bugs.pyth

[issue43080] pprint for dataclass instances

2021-01-30 Thread Lewis Gaul
Change by Lewis Gaul : -- keywords: +patch pull_requests: +23204 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24389 ___ Python tracker ___

[issue43080] pprint for dataclass instances

2021-01-30 Thread Lewis Gaul
New submission from Lewis Gaul : Currently the pprint module does not have support for dataclasses. I have implemented support for this and will link the PR once I have the issue number! See also issue37376 for SimpleNamespace support. -- components: Library (Lib) messages: 386002

[issue42914] pprint numbers with underscore

2021-01-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> format(10**9, '_d') '1_000_000_000' -- nosy: +serhiy.storchaka ___ Python tracker ___ ___

[issue42914] pprint numbers with underscore

2021-01-13 Thread Eric V. Smith
Eric V. Smith added the comment: +1 also. I agree with Raymond it should be optional. -- nosy: +eric.smith ___ Python tracker ___

[issue42914] pprint numbers with underscore

2021-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It would be nice if pprint learned to insert underscores in long numbers +1 but I would make this optional. > Here is an implementation of the safe repr for numbers if helpful I suggest using the existing string formatting tools as a foun

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
Felipe added the comment: Here is an implementation of the safe repr for numbers if helpful: ``` def safe_repr_int(object): sign = '' if object < 0: sign = '-' object = -object r = repr(object) if len(r) <= 4: return sign + r parts = [sign]

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
New submission from Felipe : It would be nice if pprint learned to insert underscores in long numbers Current behavior: >>> pprint.pprint(int(1e9)) 10 Desired behavior >>> pprint.pprint(int(1e9)) 1_000_000_000 Wikipedia tells me that "groups of 3" i

[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: fixed -> not a bug ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way, there is no need to use the u'' prefix on strings in Python 3. Unfortunately, I think this is a case where pprint doesn't meet your expectations. pprint is designed to print the repr of a string, while regular print prints the human-visible str

[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42852] pprint fails in transformming non-breaking space

2021-01-06 Thread Xinmeng Xia
New submission from Xinmeng Xia : "pprint" can transform unicode like "print". However, pprint fails to transform non-breaking space('\240') . See the following example: Python 3.10.0a2 (default, Nov 24 2020, 14:18:46) [GCC 7.5.0] on linux Type "help", &quo

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2020-11-04 Thread Irit Katriel
Irit Katriel added the comment: I think this is a bug. There is recursion detection in pprint for dicts, lists and tuples, but it only applies when __repr__ has not been overridden in a subclass. If you remove the __repr__ definition from NiceObject then str(s) works. -- nosy

[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2020-11-04 Thread Danylo Hlynskyi
` When I replace str() call with pprint.saferepr(), I end up in infinite recursion. ``` import pprint class ReallyNiceObject: def __str__(self): return pprint.saferepr(self.__dict__) def __repr__(self): return str(self) ``` Same happens for pprint.pformat(), with

[issue34798] pprint ignores the compact parameter for dicts

2020-09-19 Thread Irit Katriel
Change by Irit Katriel : -- assignee: -> docs@python components: +Documentation nosy: +docs@python ___ Python tracker ___ ___

[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Irit Katriel
Irit Katriel added the comment: Thank you Serhiy. This ticket can be closed now. -- ___ Python tracker ___ ___ Python-bugs-list

[issue39994] pprint handling of dict subclasses that override __repr__

2020-08-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 582f13786bb75c73d609790967fea03a5b50148a by Irit Katriel in branch 'master': bpo-39994: Fix pprint handling of dict subclasses that override __repr__ (GH-21892) https://github.com/python/cpython/commit

[issue34798] pprint ignores the compact parameter for dicts

2020-08-22 Thread Irit Katriel
Irit Katriel added the comment: > At the very least it should be made clear in the documentation that dicts are > not compacted. According to https://docs.python.org/3/library/pprint.html compact impacts the way that sequences are displayed, and a dict is not a sequence. So I'm not sure a

[issue41546] pprint() gives exception when ran from pythonw

2020-08-17 Thread Steve Dower
Steve Dower added the comment: I'm inclined to agree that it should pass silently in this case, as if it were printing with print() rather than .write(). What better meaning is there for sys.stdout == None than "no output"? -- versions: +Python 3.10 -Python 3.8

[issue41546] pprint() gives exception when ran from pythonw

2020-08-17 Thread Vedran Čačić
Vedran Čačić added the comment: The big part of the justification for making print a function in Py3 is that it can be painlessly replaced with other functions, such as (example given by BDFL) pprint.pprint. I think we should do what we can to make the replacement as painless as possible.

  1   2   3   4   5   6   >