[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: What I'm hoping is to get agreement on what the behavior should be (unspecified format codes use str or repr, specified numeric codes use the value), and then persuade folks that int (or PyLong) is where that behavior should be kept (so int is subclass friendly

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: I don't think it's possible for int (PyLong) to handle a decision to format itself as a string. Personally, I'd like this: >>> format(3, 's') Traceback (most recent call last): File "", line 1, in ValueError: Unknown format code 's' for object of type 'int'

[issue15428] add "Name Collision" section to argparse docs

2013-08-14 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/m

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Changes by Eric V. Smith : -- assignee: -> ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: --> class Test(enum.IntEnum): ... one = 1 ... two = 2 ... --> '{}'.format(Test.one) 'Test.one' --> '{:d}'.format(Test.one) '1' --> '{:}'.format(Test.one) 'Test.one' --> '{:10}'.format(Test.one) ' 1' Sometimes the str is used, and sometimes the valu

[issue18741] Fix typos/spelling mistakes in Lib/*/*/.py files

2013-08-14 Thread Févry Thibault
New submission from Févry Thibault: Using the same tool described in issue 18705, I fixed more typos. -- assignee: docs@python components: Documentation files: another_typo_patch.diff keywords: patch messages: 195216 nosy: docs@python, iwontbecreative priority: normal severity: normal st

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: The value of int is always used, except when the format string is empty. PEP 3101 explicitly requires this behavior. "For all built-in types, an empty format specification will produce the equivalent of str(value)." The "built-in type" here refers to int, since

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: So what you're saying is that '{:}' is empty, but '{:10}' is not? -- ___ Python tracker ___ ___ Python

[issue18647] re.error: nothing to repeat

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: So what now? Just remove unneeded check? Related issues: issue1633953, issue2537. -- ___ Python tracker ___ _

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: > So what you're saying is that '{:}' is empty, but '{:10}' is not? Yes, exactly. The part before the colon says which argument to .format() to use. The empty string there means "use the next one". The part after the colon is the format specifier. In the first

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 2:38 PM, Eric V. Smith wrote: > > Eric V. Smith added the comment: > > > So what you're saying is that '{:}' is empty, but '{:10}' is not? > > Yes, exactly. The part before the colon says which argument to .format() > to use. The empty str

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-14 Thread Nick Coghlan
Nick Coghlan added the comment: I think you make a good case, but I already tried and failed to convince Guido of this in PEP 377 (see http://www.python.org/dev/peps/pep-0377/#rationale-for-change) More importantly, see his quoted concerns in http://mail.python.org/pipermail/python-dev/2009-M

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: It's not whether a field width is specified that makes it "empty" or not, it's where there's anything in the format specifier at all. I'm trying to simplify the conversation by using format() instead of str.format(), but I'm not succeeding! Going back to str.f

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > In order to avoid that logic, and cause more format specifiers to result in > str-like behavior, we'll need to implement an __format__ somewhere (IntEnum, > I guess) that makes the "int or str" decision. If this is the way format is supposed to work, then I'll

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: >> In order to avoid that logic, and cause more format specifiers to result in >> str-like behavior, we'll need to implement an __format__ somewhere (IntEnum, >> I guess) that makes the "int or str" decision. > > If this is the way format is supposed to work, t

[issue18742] Abstract base class for hashlib

2013-08-14 Thread Christian Heimes
New submission from Christian Heimes: All hashlib types provide a common interfaces but there is no common super class. The patch implements provides hashlib.CryptoHash abstract base class as common virtual class for all hash types. The patch also exposes all internal types of the internal has

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Drat. IntEnum is supposed to be a drop-in replacement for int. I guess I'll have to consider more than just the letter code to decide whether to go with int.__format__ or str.__format__. -- ___ Python tracker

[issue18425] IDLE Unit test for IdleHistory.py

2013-08-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: Moved most initialization to method setUp to prevent cascading of test failures. Added info about History.fetch and FetchTest.fetch_test methods. Added tests for non-cyclic and special behavior and for fetch event wrappers. Coverage is essentially 100%. -

[issue18698] importlib.reload() does not return the module in sys.modules

2013-08-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset e22e7268e58a by Eric Snow in branch '3.3': issue #18698: ensure importlib.reload() returns the module out of sys.modules. http://hg.python.org/cpython/rev/e22e7268e58a New changeset 1af087712e69 by Eric Snow in branch 'default': Closes issue #18698:

[issue18698] importlib.reload() does not return the module in sys.modules

2013-08-14 Thread Eric Snow
Eric Snow added the comment: oops. That commit message for 3.3 should have read "imp.reload()". :) -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker _

[issue18743] References to non-existant "StringIO" module

2013-08-14 Thread Jesús Cea Avión
New submission from Jesús Cea Avión: Doing a "grep StringIO Doc/library/*.rst" shows a handful of references to the old StringIO library. Notably: gzip.rst mailbox.rst tempfile.rst test.rst unittest.mock.rst xml.dom.minidom.rst -- assignee: docs@python components: Documentation message

[issue18744] pathological performance using tarfile

2013-08-14 Thread K Richard Pixley
New submission from K Richard Pixley: There's a problem with tarfile. Write a program to traverse the contents of a modest sized tar archive. Make sure your tar archive is compressed. Then read the tar archive with your program. I'm finding that allowing tarfile to read a compressed archive

[issue18219] csv.DictWriter is slow when writing files with large number of columns

2013-08-14 Thread Mikhail Traskin
Mikhail Traskin added the comment: > What is the purpose in touching fieldnames [...] Wrapping the fieldnames property and tupleizing it guarantees that fieldnames and _fieldset fields are consistent. Otherwise, having a separate _fieldset field means that someone who is modifying the fieldnam

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: The dont-compare-first-last patch looks about right. The "if (len == 0) return 1;" shortcut perhaps should be taken out. It makes the common case pay (if only slightly) for the rare case (which of course, never gets predicted). This whole code block gets

[issue18744] pathological performance using tarfile

2013-08-14 Thread Ned Deily
Changes by Ned Deily : -- nosy: +lars.gustaebel ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

<    1   2