[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-07-29 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Thanks for accepting the patch. Looking forward to 3.6 ! :-) -- ___ Python tracker ___ ___ Pyth

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-07-29 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the patch, Matthias. -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___ _

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-07-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset dcc00d9ba8db by Berker Peksag in branch 'default': Issue #24360: Improve __repr__ of argparse.Namespace() for invalid identifiers. https://hg.python.org/cpython/rev/dcc00d9ba8db -- nosy: +python-dev ___ P

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-07-29 Thread Berker Peksag
Changes by Berker Peksag : -- assignee: -> berker.peksag ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-07-29 Thread R. David Murray
R. David Murray added the comment: If one is going to have a repr at all, I think it should be as accurate as practical. I think this is worthwhile, and favor the existing patch. -- nosy: +r.david.murray ___ Python tracker

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: As far as I remember, argparse is not only use to parse things from sys.argv where the quoting is not necessary. And Namespace is not only use in argparse. But if you don't want improvement, feel free to close. --

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread paul j3
paul j3 added the comment: I mentioned in the related bug/issue that no one has to use odd characters and spaces in the Namespace. While they are allowed by 'getattr' etc, the programmer has the option of supplying rational names in the 'dest' parameter. There's also the question of what ki

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: > Namespace(a=1, 'b=2), Namespace(c'=3) :-) I read that a `prime-b`=2 and `c-prime`=3. I just feel like having a repr which is closer to the constructor signature is better, but I guess it's a question of taste. Anyway, both would be fine. -- __

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread paul j3
paul j3 added the comment: An alternative would be to wrap a non-identifier name in 'repr()': def repr1(self): def fmt_name(name): if name.isidentifier(): return name else: return repr(name) type_name = type(self).__name

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Sure and anyway if you have a huge namespace, things will become unreadable. But during development/teaching, having object that have a "sane" representation is useful, otherwise your brain (well at least mine), choke on the output and break the flow of m

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread paul j3
paul j3 added the comment: Off hand I don't see a problem with this patch (but I haven't tested it yet). But I have a couple of cautions: The docs say, regarding the Namespace class: > This class is deliberately simple, just an object subclass with a readable > string representation. This pa

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- nosy: +bethard, serhiy.storchaka stage: patch review -> commit review ___ Python tracker ___

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-02 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-01 Thread Matthias Bussonnier
New submission from Matthias Bussonnier: The argparse Namespace can be missleading in case where the args names are not valid identifiers, eg thinks like a closing bracket: In [5]: Namespace(a=1, **{')':3}) Out[5]: Namespace()=3, a=1) more funny: In [3]: Namespace(a=1, **{s:3}) Out[3]: Namesp