[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: Discussion started on PyDev. While working on that I realized/remembered that the main reason to get this in now is that without it a user *cannot* change how pickling works -- (s)he can write the methods, but they will be ignored

[issue20653] Pickle enums by name

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: Many comments, Eli's and Serhey's code changes incorporated. -- Added file: http://bugs.python.org/file34173/issue20653.stoneleaf.02.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653

[issue20653] Pickle enums by name

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: Antoine, If the mixed-in class defines __reduce_ex__, and the Enum class defines __reduce__, pickle will see that the Enum class has both, and will call the _ex__ method. It is, therefore, the preferred method (at least by pickle, which is what we

[issue20653] Pickle enums by name

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: Yeah, I was confused by that when I first read it as well. The 2.7 docs are even worse in that regard (so there has been some progress :). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue20653] Pickle enums by name

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: Antoine commented: -- The pickle docs don't mention __reduce_ex__ as being preferred, as in you should use this one, on the contrary. Are we reading the same docs? http://docs.python.org/dev/library/pickle.html#object.__reduce_ex__

[issue20653] Pickle enums by name

2014-02-21 Thread Ethan Furman
Ethan Furman added the comment: On 02/21/2014 11:26 AM, Antoine Pitrou wrote: Are we reading the same comments? LOL, apparently not. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: When I implemented pickle support I did not have a complete understanding of the pickle protocols nor how to best use them. As a result, I picked __getnewargs__ and only supported protocols 2 and 3 (4 didn't exist yet). Serhiy came along and explained a bunch

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-20 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- Removed message: http://bugs.python.org/msg211739 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20679

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: When I implemented pickle support I did not have a complete understanding of the pickle protocols nor how to best use them. As a result, I picked __getnewargs__ and only supported protocols 2 and 3 (4 didn't exist yet). Serhiy came along and explained a bunch

[issue20653] Pickle enums by name

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: When I implemented pickle support I did not have a complete understanding of the pickle protocols nor how to best use them. As a result, I picked __getnewargs__ and only supported protocols 2 and 3 (4 didn't exist yet). Serhiy came along and explained a bunch

[issue20653] Pickle enums by name

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: More explanation: __getnewargs__ is not used by pickle protocol 0 and 1; to support those protocols we need __reduce_ex__. Since __reduce_ex__ works for 0, 1, 2, 3, 4, ... there's no reason to have both __reduce_ex__ *and* __getnewargs__

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: Larry, If I make changes to the patch, should I reverse the original and then commit one new one so you only have one to merge in, or do you mind having two to do? -- ___ Python tracker rep...@bugs.python.org http

[issue20653] Pickle enums by name

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: Thanks for your comments, Eli, I'll work on getting better comments in the code. The qualname comment is partially related to the pickling changes as it's necessary for protocol 4 (I forgot to put that comment in on the previous pickling change that addressed

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-20 Thread Ethan Furman
Ethan Furman added the comment: Can we do that? If a doc change can make it so we're not locked in to supporting __getnewargs__ I could live with that. Although, to be honest, I'd rather get the change in *and* have a doc warning that pickling specifics are subject to change in 3.5. Really

[issue20653] Pickle enums by name

2014-02-18 Thread Ethan Furman
Ethan Furman added the comment: And it is now possible to override and pickle by name if your custom subclass so chooses. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653

[issue20653] Pickle enums by name

2014-02-18 Thread Ethan Furman
Ethan Furman added the comment: Patch allows subclass to override __reduce_ex__, which is useful if a mixed-in type does not have proper pickle support. -- Added file: http://bugs.python.org/file34138/issue20653.stoneleaf.01.patch ___ Python tracker

[issue20653] Pickle enums by name

2014-02-18 Thread Ethan Furman
Ethan Furman added the comment: Proposal to switch to pickle by name rejected, but Enum now allows __reduce_ex__ to be overwridden in subclasses. -- priority: release blocker - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior

2014-02-18 Thread Ethan Furman
New submission from Ethan Furman: 587fd4b91120: Better pickle support for Enum subclasses. -- assignee: larry messages: 211552 nosy: ethan.furman, larry priority: release blocker severity: normal stage: commit review status: open title: 3.4 cherry-pick: 587fd4b91120 improve Enum

[issue20653] Pickle enums by name

2014-02-17 Thread Ethan Furman
Ethan Furman added the comment: I agree that pickling by name is the better solution. Serhiy, could you explain how the un-pickling works with protocol 4? -- assignee: - ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue18652] Add itertools.first_true (return first true item in iterable)

2014-02-15 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18652 ___ ___ Python-bugs-list

[issue11406] There is no os.listdir() equivalent returning generator instead of list

2014-02-13 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11406 ___ ___ Python-bugs-list

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: The only thing I hate more than being wrong is being wrong because Python isn't acting the way I think it should. :/ So, __qualname__ is not set properly when using the function API (although it has nothing to do with manually setting __module__ (I removed

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: Serhiy commented: - Actually they don't pickle due to wrong __module__. After adding NEI.__module__ = NamedInt.__module__ = __name__ PicklingError no longer raised for enum class. If you were to look at the `_make_class_unpicklable

[issue20534] Enum tests fail with pickle protocol 4

2014-02-08 Thread Ethan Furman
Ethan Furman added the comment: I do not recall if it was or not. The main difference would be in how aliases were handled. For example, if W and Z were the same value on system A, but different on system B, then going from A - B via pickle W and Z would still be the same using the current

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Because I didn't know how to make it work with 0 and 1. Thank you! I'll get that in today. -- stage: committed/rejected - patch review status: closed - open ___ Python tracker rep...@bugs.python.org http

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Okay, I went with __reduce__ since we don't ever use the pickle protocol information. I added a test for class-nested Enums since protocol 4 supports it. I left the test for test_subclasses_without_getnewargs alone as the point of that test is to make sure

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: I also removed the protocol 2 warning from the docs, and added this note: .. note:: With pickle protocol version 4 it is possible to easily pickle enums nested in other classes. -- ___ Python tracker rep

[issue20543] ** operator does not overflow to inf

2014-02-07 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20543 ___ ___ Python-bugs-list

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: The version 2 docs: http://docs.python.org/2/library/pickle.html#object.__reduce_ex__: - The object class implements both __reduce__() and __reduce_ex__(); however, if a subclass overrides

[issue20534] Enum tests fail with pickle protocol 4

2014-02-07 Thread Ethan Furman
Ethan Furman added the comment: Ethan commented: I left the test for test_subclasses_without_getnewargs alone as the point of that test is to make sure that _make_class_unpicklable is working properly, not to see if we can somehow get any of it to pickle. Serhiy replied

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Thanks for the hints, Georg! -- Added file: http://bugs.python.org/file33945/issue20386.stoneleaf.04.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20386

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
New submission from Ethan Furman: enum34, the Enum backport, specifically uses `protocol=HIGHEST_PROTOCOL`, while the current enum tests just use the default. Running the enum34 test expose an issue with pickle protocol 4

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Working on fixing tests now. Not sure I can fix pickle (at least not in time for RC1). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20534

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Thanks, Antoine, that was what I needed. -- assignee: - ethan.furman keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file33949/issue20534.stoneleaf.01.patch ___ Python tracker rep

[issue20534] Enum tests fail with pickle protocol 4

2014-02-06 Thread Ethan Furman
Ethan Furman added the comment: Serhiy, the minimum supported pickle protocol is 2. Now testing all protocols from 2 to HIGHEST_PROTOCOL, inclusive. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20534

[issue20457] Use partition and enumerate make getopt easier

2014-01-31 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20457 ___ ___ Python-bugs-list

[issue20467] Confusing wording about __init__

2014-01-31 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20467 ___ ___ Python-bugs-list

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-27 Thread Ethan Furman
Ethan Furman added the comment: Well, so far I have tried: :class:`IntEnum` :class:`.IntEnum` :class:`~IntEnum` :class:`enum.IntEnum` :class:`.enum.IntEnum` :class:`~enum.IntEnum` :class:`~.enum.IntEnum` and probably some others I have forgotten; nothing is giving me a link

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-27 Thread Ethan Furman
Ethan Furman added the comment: IntEnum is not a class in the socket module. How do I make a link into another rst document? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20386

[issue20412] Enum and IntEnum classes are not defined in the documentation

2014-01-27 Thread Ethan Furman
New submission from Ethan Furman: While trying to update the socket documentation it was brought to my attention that Enum and IntEnum are not defined as classes as far as the docs are concerned [1]. [1] http://bugs.python.org/issue20386#msg209473 -- assignee: ethan.furman messages

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-26 Thread Ethan Furman
Ethan Furman added the comment: Okay, staying with SocketKind. This patch also has a very small doc enhancement. -- keywords: +patch Added file: http://bugs.python.org/file33735/issue20386.stoneleaf.03.patch ___ Python tracker rep...@bugs.python.org

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-25 Thread Ethan Furman
Ethan Furman added the comment: Here's a patch for the test. -- Added file: http://bugs.python.org/file33706/issue20386.stoneleaf.test.patch.01 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20386

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-25 Thread Ethan Furman
Ethan Furman added the comment: Complete patch with new test, fixed tests, and regression fix. Doc patch still needed. -- stage: test needed - patch review Added file: http://bugs.python.org/file33707/issue20386.stoneleaf.patch.02 ___ Python tracker

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-25 Thread Ethan Furman
Ethan Furman added the comment: The containers are there to help with discoverability. If you want to know what all the (common) AF values are you can either do [name for name in dir(socket) if name.isupper() and name.startswith('AF_')] or list(socket.AddressFamily

[issue20386] socket.SocketType enum overwrites import of _socket.SocketType

2014-01-25 Thread Ethan Furman
Ethan Furman added the comment: How do we feel about SockType instead? (Just a short round of bike-shedding, promise! ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20386

[issue20284] patch to implement %-interpolation for bytes (roughly PEP 461)

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20284 ___ ___ Python-bugs-list

[issue18574] BaseHTTPRequestHandler.handle_expect_100() sends invalid response

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18574 ___ ___ Python-bugs-list

[issue12704] Language Reference: Clarify behaviour of yield when generator is not resumed

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12704 ___ ___ Python-bugs-list

[issue7776] http.client.HTTPConnection tunneling is broken

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7776 ___ ___ Python-bugs-list

[issue17814] Popen.stdin/stdout/stderr documentation should mention object type

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17814 ___ ___ Python-bugs-list

[issue17811] Improve os.readv() and os.writev() documentation and docstring

2014-01-17 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17811 ___ ___ Python-bugs-list

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-14 Thread Ethan Furman
Ethan Furman added the comment: Depracation warning is in place for 3.4. When 3.5 is tagged I'll switch it an error. -- stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19995

[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2014-01-12 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1820 ___ ___ Python-bugs-list

[issue20230] structseq types should expose _fields

2014-01-12 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20230 ___ ___ Python-bugs-list

[issue16508] include the object type in the lists of documented types

2014-01-11 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16508 ___ ___ Python-bugs-list

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-10 Thread Ethan Furman
Ethan Furman added the comment: For anyone paying really close attention, I've already switched the assertEquals to assertEqual. ;) -- Added file: http://bugs.python.org/file33414/issue19995.stoneleaf.04.patch ___ Python tracker rep

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-09 Thread Ethan Furman
Ethan Furman added the comment: Could somebody explain this? === ethan@media:~/source/python/issue19995_depr$ ./python -W error Python 3.4.0b1 (default:2f81f0e331f6+, Jan 9 2014, 20:30:18) [GCC 4.7.3] on linux Type

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman
Ethan Furman added the comment: I was travelling yesterday and wasn't sure about the time stamp. Looks like I missed the 12-hour cutoff. Let me know if I should backout the commit. -- ___ Python tracker rep...@bugs.python.org http

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman
Ethan Furman added the comment: I think the code-breakage issue is that although this is a bug now, it did not use to be a bug. (Or maybe it was always a bug, but nobody noticed -- I don't know when hex() and oct() were introduced.) Basically, having %o and %x work with floats

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-01-05 Thread Ethan Furman
Ethan Furman added the comment: I'll switch it to a deprecation warning instead sometime this week. The changes to datamodel.rst and tarfile.py should stay, I think. test_format and test_unicode will both verify current* behavior and check for the deprecation warning, and unicodeobject.c

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2013-12-30 Thread Ethan Furman
Ethan Furman added the comment: Better doc enhancement thanks to R. David Murray (thanks!). -- Added file: http://bugs.python.org/file33289/issue19995.stoneleaf.03.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19995

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2013-12-30 Thread Ethan Furman
Ethan Furman added the comment: I can see why we wouldn't want to make this change in a point release, but this is a feature release we're talking about and this seems like buggy behavior: -- hex(3.14) Traceback (most recent call last): File stdin, line 1, in module TypeError: 'float' object

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2013-12-30 Thread Ethan Furman
Ethan Furman added the comment: I can live with the deprecation route. I'll create a patch today or tomorrow for that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19995

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2013-12-29 Thread Ethan Furman
Ethan Furman added the comment: In issue19995, in msg206339, Guido exhorted: [Ethan claimed] it is possible to want a type that can be used as an index or slice but that is still not a number I'm sorry, but this requirement is absurd. An index

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2013-12-29 Thread Ethan Furman
Ethan Furman added the comment: Ran full test suite; some errors came up in test_format from the following test lines: testformat(%#x, 1.0, 0x1) testformat(%x, float(big), 123456___, 6) testformat(%o, float(big), 123456__, 6) testformat(%x

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2013-12-29 Thread Ethan Furman
Ethan Furman added the comment: I have the following as part of the patch for that issue: - diff -r b668c409c10a Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst Sat Dec 28 20:37:58 2013 +0100 +++ b/Doc/reference

[issue20094] intermitent failures with test_dbm

2013-12-29 Thread Ethan Furman
New submission from Ethan Furman: Following errors occur about half the time: == ERROR: test_anydbm_creation (test.test_dbm.TestCase-dbm.ndbm) -- Traceback

[issue20094] intermitent failures with test_dbm

2013-12-29 Thread Ethan Furman
Ethan Furman added the comment: Actually, make that about 1/5 of the time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20094 ___ ___ Python

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2013-12-29 Thread Ethan Furman
Ethan Furman added the comment: I updated it as I liked your wording better. :) Doing more testing to see if anything else needs fixing before I make the next patch for the tracker on that issue. -- ___ Python tracker rep...@bugs.python.org http

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2013-12-28 Thread Ethan Furman
New submission from Ethan Furman: In order to create a coherent integer type class both __int__ and __index__ must be defined or the resulting instances will behave inconsistently in different places. For example, if __index__ is not defined then the class cannot be used in slices

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2013-12-28 Thread Ethan Furman
Ethan Furman added the comment: Enhancement portion split off into issue20092. Attached patch includes doc change, tests, and code changes. If I'm overstepping my bounds, I'm sure somebody will slap me with a fish. ;) -- keywords: +patch stage: test needed - patch review title: hex

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2013-12-28 Thread Ethan Furman
Ethan Furman added the comment: True. I meant similar in that Python will use what's available to fill in the blank: class has __eq__ but user tried != ? use __eq__ and invert result class has __index__ but user tried int() ? use __index__

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-23 Thread Ethan Furman
Ethan Furman added the comment: Thank you everyone for increasing my understanding. :) Terry J Reedy wrote: [snip everything I now agree with, which is most of Terry's comment] 3. Every core usage of __int__ looks for __index__ also. Int() does not do this now, but '%d

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
New submission from Ethan Furman: Using Enum to illustrate: -- class Grade(enum.Enum): ... A = 4 ... B = 3 ... C = 2 ... D = 1 ... F = 0 ... def __index__(self): ... return self._value_ -- ['miserable'][Grade.F] 'miserable' -- '%x

[issue19988] hex() and oct() use __index__ instead of __int__

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Guido van Rossum opined: I still think the problem is with your class design. You shouldn't want a hex representation for a value that's not an integer. Well, in fairness I only supported it because bool does, and I was trying to have

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Victor Stinner commented: - I never understood the difference between long (__int__ method) and index (__index__ method). Is the difference on the behaviour of floating point numbers? __index__ was originally added so that non-int

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Did I mention __index__ is an unfortunate name for the current trend for this method? Stefan Krah commented: -- memoryview, struct and probably also array.array accept __index__. When you say accept __index__ do you mean for use as indices

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Hmmm... Well, much as I hate to say it, it's sounding like the correct solution here is to have %o and %x work when __index__ is available, instead of the other way around. :( .format is not an issue because one must specify one's own if inheriting from

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Eric V. Smith commented: If you were going to make this change, I'd think you'd have to look for __index__ and then __int__. Does the order matter? Are there any types (and should there be) that would have both and return different

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Antoine Pitrou opined: -- I'm with Guido: it doesn't really make sense to allow __index__ but not __int__ on a type. So trying __index__ in str.format() sounds like a distraction. -- hex(3.14) # calls __index__ Traceback (most recent

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Ethan Furman previously stated: --- So the complete list of spcecifiers then is d, i, o, u, U, and c [1], and they should work if __index__ works. Okay, so 'd' then should be considered a conversion operation, whilst the others

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Antoine, if I understand you correctly, you are saying that any type that defines __index__ is an integer, and should therefore also define __int__, in which case Python can just use __int__ and not worry about __index__? Here's the problem with that: -- '%x

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Antoine, Does that mean you are reducing your previous statement of So trying __index__ in str.format() sounds like a distraction. to using __index__ for %d, %i, and %u is not correct, but is correct for %c, %o, %x, and %X

[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-16 Thread Ethan Furman
Ethan Furman added the comment: Thank you, Victor and Serhiy, for your pointers into the code. I'm hoping we have general agreement about %c, %o, %x, and %X and having them use __index__ only (using __int__ would open the door to float conversions). I still have a question about %i, though

[issue19988] hex() and oct() use __index__ instead of __int__

2013-12-15 Thread Ethan Furman
New submission from Ethan Furman: In Py3k __hex__ and __oct__ were removed, and hex() and oct() switched to use __index__. hex() and oct() should be using __int__ instead. Having read through PEP 357 [1] I see that __index__ is /primarily/ concerned with allowing arbitrary objects to be used

[issue19988] hex() and oct() use __index__ instead of __int__

2013-12-15 Thread Ethan Furman
Ethan Furman added the comment: For the record, the true/false values of my Logical type do convert to int, just not the unknown value. I agree using __int__ is dubious because of float (and Decimal, etc.), which means really the only clean way to solve the issue (definitely for me

[issue8075] Windows (Vista/7) install error when choosing to compile .py files

2013-12-03 Thread Ethan Furman
Ethan Furman added the comment: Just tried installing 2.6.6 on Windows 7 with compile checked and make default unchecked and did not observe any problems (although it did scroll by at high speed, and the windows didn't stay open for me to peruse). However, since we are no longer releasing

[issue19624] Switch constants in the errno module to IntEnum

2013-11-25 Thread Ethan Furman
Ethan Furman added the comment: Check out socket.py for an example of constants being changed over to IntEnum. Feel free to ask more questions! :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624

[issue19624] Switch constants in the errno module to IntEnum

2013-11-25 Thread Ethan Furman
Ethan Furman added the comment: Also see Issue18720 for those details. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___ ___ Python-bugs

[issue19249] Enumeration.__eq__

2013-11-13 Thread Ethan Furman
Ethan Furman added the comment: changeset ca909a3728d3 -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19249

[issue19249] Enumeration.__eq__

2013-11-10 Thread Ethan Furman
Ethan Furman added the comment: Done and done. -- stage: test needed - patch review Added file: http://bugs.python.org/file32572/issue19249.stoneleaf.02.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19249

[issue19249] Enumeration.__eq__

2013-11-08 Thread Ethan Furman
Ethan Furman added the comment: Given that __eq__ isn't adding anything, I think removing it is a fine option. -- keywords: +patch Added file: http://bugs.python.org/file32548/issue19249.stoneleaf.01.patch ___ Python tracker rep...@bugs.python.org

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2013-11-01 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15873 ___ ___ Python-bugs-list

[issue19331] Revise PEP 8 recommendation for class names

2013-10-31 Thread Ethan Furman
Ethan Furman added the comment: How's this? I liked Barry's simpler Overriding Principle combine with Nick's simpler Class Names. -- Added file: http://bugs.python.org/file32444/issue19331.stoneleaf.03.patch ___ Python tracker rep

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Do we currently have any data structures in Python, either built-in or in the stdlib, that aren't documented as raising RuntimeError if the size changes during iteration? list, dict, set, and defaultdict all behave this way. If not, I think OrderedDict should

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Ah, right you are: list just acts wierd. ;) So the question then becomes is OrderedDict more like a list or more like a dict? It seems to me that OrderedDict is more like a dict. -- ___ Python tracker rep

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: The further from dict it goes, the more there is to remember. Considering the work around is so simple, I just don't think it's worth it: for key in list(ordered_dict): if some_condition: del ordered_dict[key] A simple list around

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Firstly, you're not copying the entire dict, just its keys. [1] Secondly, you're only copying the keys when you'll be adding/deleting keys from the dict. Thirdly, using the list idiom means you can use OrderedDicts, defaultdicts, dicts, sets, and most likely

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Nikolaus, in reply to your question about more to remember: Even though I may not use it myself, if it is allowed then at some point I will see it in code; when that happens the sequence of events is something like: 1) hey, that won't work 2) oh, wait

[issue19414] OrderedDict.values() behavior for modified instance

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Personally, I would rather see a RuntimeError raised. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19414

<    10   11   12   13   14   15   16   17   18   19   >