[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-06-11 Thread Ethan Furman
Ethan Furman added the comment: Final (hopefully! ;) patch. I stuck the toc reference in datatypes. If no more edits are necessary I'll commit on Friday (three days from now). -- Added file: http://bugs.python.org/file30548/pep-0435.12.stoneleaf.

[issue17947] Code, test, and doc review for PEP-0435 Enum

2013-06-14 Thread Ethan Furman
Ethan Furman added the comment: Well, that made me laugh first thing in the morning! I had nuked and redone my clone, and yeah, forgot to re-add the files. :/ Trying again... Commit message was okay? -- ___ Python tracker <http://bugs.python.

[issue17961] Use enum names as values in enum.Enum() functional API

2013-06-18 Thread Ethan Furman
Ethan Furman added the comment: Enum members have two pieces of easily accessible information: `name` and `value`. The name is taken from the attribute the value is assigned to; the value, obviously, is the value assigned. The question, then, is what should happen when the function syntax is

[issue18042] Provide enum.unique class decorator

2013-06-18 Thread Ethan Furman
Ethan Furman added the comment: I haven't seen any discouraging words regarding the decorator. If no one has any compelling reasons why it shouldn't be added, I'll craft a version and put it in (only real difference with Nick's would be catching all the duplicates at once

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: Nick, in your example it looks like json is using the __str__ for int, but the __repr__ for float -- is this correct? -- assignee: -> ethan.furman nosy: +eli.bendersky, ethan.furman ___ Python tracker &l

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: I have no problem with leaving __str__ as the inherited type's, and just keeping the __repr__ as the enum add-on; this could be one of the differences between a pure Enum and a hybrid Enum. Is it safe to change the json behaviour back to using __str_

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: Eric, The pickle support is solely in Enum. No changes were made to pickles. -- ___ Python tracker <http://bugs.python.org/issue18

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: I was unable to find any references to previous problems with json and floats. A quick-n-dirty patch yields the following: --> from json import dumps, loads --> from enum import Enum --> class FE(float, Enum): ... pass ... --> class Test(FE): ...

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ezio.melotti, rhettinger ___ Python tracker <http://bugs.python.org/issue18264> ___ ___ Python-bugs-list mailing list Unsub

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Ethan Furman
Ethan Furman added the comment: Here's the relevant routine from _json.c: - static PyObject * encoder_encode_float(PyEncoderObject *s, PyObject *obj) { /* Return the JSON representation of a PyFloat */ double i = PyFloat_AS_DOUBLE(obj);

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-21 Thread Ethan Furman
Ethan Furman added the comment: I'd be in favor of the __protocol__ route first and the PEP 443 route second. The problem with just tacking in `str(int(value))` or `str(float(value))` is where does it stop? StrEnum, TupleEnum, BytesEnum, ComplexEnum, SomeOtherInterestingConstantEnum

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-21 Thread Ethan Furman
Ethan Furman added the comment: On 06/21/2013 07:49 PM, Guido van Rossum wrote: > Eli Bendersky added the comment: >> >> Practically speaking, what should be done to make enum play well with JSON >> without writing new PEPs? I think we still want to convert those stdlib >

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-21 Thread Ethan Furman
Ethan Furman added the comment: Guido van Rossum added the comment: > > Yes for float() -- but for str() it would seem redundant? (Or what's > the context?) If a user has class Color(StrEnum): red = 'ff' green = '00ff00' bl

[issue18281] tarfile defines stat constants

2013-06-22 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18281> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18303> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread Ethan Furman
Ethan Furman added the comment: For the curious, here are all the tracebacks: --> json.dumps(a) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.3/json/__init__.py", line 236, in dumps return _default_encoder.encode(obj) File &

[issue18173] Add MixedTypeKey to reprlib

2013-06-26 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18173> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9938] Documentation for argparse interactive use

2013-06-28 Thread Ethan Furman
Ethan Furman added the comment: It doesn't look like xuanji has signed a CLA. Should we create a new issue, and have someone else create a new patch, and let this issue just be about the docs? -- nosy: +ethan.furman ___ Python tracker

[issue18042] Provide enum.unique class decorator

2013-06-28 Thread Ethan Furman
Ethan Furman added the comment: unique() added to enum.py; tests added; docs updated. If no complaints within a few days I'll push them through. -- keywords: +patch Added file: http://bugs.python.org/file30722/unique.stoneleaf.01.patch ___ P

[issue18042] Provide enum.unique class decorator

2013-06-28 Thread Ethan Furman
Changes by Ethan Furman : -- stage: -> patch review ___ Python tracker <http://bugs.python.org/issue18042> ___ ___ Python-bugs-list mailing list Unsubscri

[issue18042] Provide enum.unique class decorator

2013-06-29 Thread Ethan Furman
Ethan Furman added the comment: Integrated comments. -- Added file: http://bugs.python.org/file30730/unique.stoneleaf.02.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18305] [patch] Fast sum() for non-numbers

2013-07-10 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18305> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18305] [patch] Fast sum() for non-numbers

2013-07-11 Thread Ethan Furman
Ethan Furman added the comment: So making this a speed-up for generic objects using __iadd__ is out. The only question remaining is: is it worth special casing a few specific objects (list, tuple, str) to optimise performance? The str question has already been answered: it's special cas

[issue18508] enum.Enum population of _value2member_map does not match fallback search

2013-07-19 Thread Ethan Furman
Changes by Ethan Furman : -- assignee: -> ethan.furman nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18508> ___ ___ Python-bugs-list mai

[issue18510] if Enum member value is not hashable an exception is raised

2013-07-19 Thread Ethan Furman
New submission from Ethan Furman: While working on issue #18508 I stumbled across this: Traceback (most recent call last): ... File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ if value in cls._value2member_map: TypeError: unhashable type: 'list' I'l

[issue18510] dict.__contains__ raises exception instead of returning False

2013-07-19 Thread Ethan Furman
Ethan Furman added the comment: Commenting further: some_key in dict is conceptually the same as some_key in dict.keys() which /would/ return False for an unhashable key -- at least it did in 2.x; for 3.x you have to say some_key in list(dict.keys()) which seems like a step

[issue18510] dict.__contains__ and dict.keys().__contains__ raises exception instead of returning False

2013-07-19 Thread Ethan Furman
Changes by Ethan Furman : -- title: dict.__contains__ raises exception instead of returning False -> dict.__contains__ and dict.keys().__contains__ raises exception instead of returning False ___ Python tracker <http://bugs.python.org/issu

[issue18510] dict.__contains__ raises exception instead of returning False

2013-07-19 Thread Ethan Furman
Changes by Ethan Furman : -- assignee: ethan.furman -> versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker <http://bugs.python.org/issu

[issue18508] enum.Enum population of _value2member_map does not match fallback search

2013-07-19 Thread Ethan Furman
Changes by Ethan Furman : -- keywords: +patch stage: -> patch review Added file: http://bugs.python.org/file30986/issue18510.stoneleaf.01.patch ___ Python tracker <http://bugs.python.org/issu

[issue18508] enum.Enum population of _value2member_map does not match fallback search

2013-07-19 Thread Ethan Furman
Ethan Furman added the comment: Cleaner patch. -- Added file: http://bugs.python.org/file30987/issue18510.stoneleaf.02.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18545] enum always runs member_type when use_args is True

2013-07-24 Thread Ethan Furman
Changes by Ethan Furman : -- assignee: -> ethan.furman nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18545> ___ ___ Python-bugs-list mai

[issue18635] Enum sets _member_type_ to instantiated values but not the class

2013-08-02 Thread Ethan Furman
Changes by Ethan Furman : -- assignee: -> ethan.furman nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18635> ___ ___ Python-bugs-list mai

[issue18635] Enum sets _member_type_ to instantiated values but not the class

2013-08-02 Thread Ethan Furman
Ethan Furman added the comment: Ah, so the Enum class has the mixin class as wall as / instead of the Enum member (which should find it via normal attribute lookup). I have no problem with that. I'll need to make a couple more changes to the code, add a test, etc., etc. It won'

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-02 Thread Ethan Furman
Ethan Furman added the comment: I'll check you patch later against big numbers (which is where I had difficulties). If it works I'll try to make it more complete. If it doesn't, I've been working on just extraction the Enum member's value and using that (work

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-02 Thread Ethan Furman
Ethan Furman added the comment: I don't think my idea of always extracting .value is grandiose (and didn't take that long to implement on the Python side), but it is definitely forcing me to learn more about C and how Python is put together. It this point I have successfully imp

[issue18635] Enum sets _member_type_ to instantiated values but not the class

2013-08-02 Thread Ethan Furman
Ethan Furman added the comment: I also admit to being curious as to the reason it is useful, especially since it is, at this point, an implementation detail. Even so, it still makes more sense to have that attribute on the class instead of the instance

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-03 Thread Ethan Furman
Ethan Furman added the comment: Eli, your method is good. I thought I had tried something similar but I obviously had the wrong PyLong constructor. I'll get it implemented. -- ___ Python tracker <http://bugs.python.org/is

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-03 Thread Ethan Furman
Ethan Furman added the comment: Thanks for the offer, Eli, but I almost have the tests done. :) -- ___ Python tracker <http://bugs.python.org/issue18264> ___ ___

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-03 Thread Ethan Furman
Ethan Furman added the comment: Okay, patch attached with C code (thanks, Eli!), more python code, and some new tests. Only the `int` case is handled. -- Added file: http://bugs.python.org/file31141/issue18264.stoneleaf.01.patch ___ Python tracker

[issue18635] Enum sets _member_type_ to instantiated values but not the class

2013-08-03 Thread Ethan Furman
Ethan Furman added the comment: Well, aside from not having a clue as to what Chris is trying to do, should we make _member_type_ public? The only reason I put it there was to aid introspection -- Enum does not use it. -- ___ Python tracker <h

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman
Ethan Furman added the comment: I don't understand. Type checks are already performed throughout the code (int, float, True, False, NaN, Inf, etc.). What will opereator.index buy us? -- ___ Python tracker <http://bugs.python.org/is

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman
Ethan Furman added the comment: This patch handles both float and int subclasses, and includes fixes/improvements from the review. -- Added file: http://bugs.python.org/file31155/issue18264.stoneleaf.02.patch ___ Python tracker <h

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-04 Thread Ethan Furman
Ethan Furman added the comment: Forgot to add float tests. Included in this patch. -- Added file: http://bugs.python.org/file31156/issue18264.stoneleaf.03.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-06 Thread Ethan Furman
Ethan Furman added the comment: Hopefully the final patch. :) -- Added file: http://bugs.python.org/file31172/issue18264.stoneleaf.04.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-06 Thread Ethan Furman
Ethan Furman added the comment: Forgot to back out core dump tests before creating previous patch. This one even passes the tests. :/ -- Added file: http://bugs.python.org/file31173/issue18264.stoneleaf.05.patch ___ Python tracker <h

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-06 Thread Ethan Furman
Ethan Furman added the comment: I'll plan on committing no sooner than Friday unless somebody else has comments/corrections. Thanks, Eli. -- ___ Python tracker <http://bugs.python.org/is

[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-08-06 Thread Ethan Furman
Ethan Furman added the comment: > Eli Bendersky added the comment: > > Make sure to run the test(s) in refleak mode . . . How extensive should testing be? I plan on always running the refleak mode tests (now that I know how ;) . Should I also run non-refleak tests? Should I run tes

[issue18693] help() not helpful with enum

2013-08-08 Thread Ethan Furman
New submission from Ethan Furman: help(), when used on an enum member or class, returns almost nothing. I suspect the custom __dir__ is at fault, but whatever is causing the problem needs fixing. -- assignee: ethan.furman messages: 194714 nosy: barry, eli.bendersky, ethan.furman

[issue18693] help() not helpful with enum

2013-08-08 Thread Ethan Furman
Ethan Furman added the comment: With custom __dir__: Help on class Enum in module enum: Enum = Without custom __dir__: Help on class Enum in module enum: class Enum(builtins.object) | Generic enumeration. | | Derive from this

[issue18693] help() not helpful with enum

2013-08-10 Thread Ethan Furman
Ethan Furman added the comment: Sorry, sorry. Long week, felt like more than two days, mild sense of unease and stress due to non-functioning Release Schedule on python.org, and wanting to get Enum used /somewhere/ in the stdlib before 3.4 is locked down. Making help() better would be a

[issue18693] help() not helpful with enum

2013-08-11 Thread Ethan Furman
Ethan Furman added the comment: So what do we want Enum's __dir__ to report? Normally we see things like __eq__, __dict__, __getnewargs__, etc. For IntEnum there would be __abs__, __floor__, __div__, etc. Do we want to worry about those kinds of differences? I think we do. And if

[issue18693] help() not helpful with enum

2013-08-11 Thread Ethan Furman
Ethan Furman added the comment: Huh. I just checked `help(Color)` on my proposed __dir__ and got the two-line, rather useless, response. Perhaps help() is broken with all custom __dir__s. -- ___ Python tracker <http://bugs.python.org/issue18

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Issue18738 created. -- ___ Python tracker <http://bugs.python.org/issue18720> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
New submission from Ethan Furman: While `.format()` works fine with enum, %-formatting does not: --> class AF(enum.IntEnum): ... IPv4 = 1 ... IPv6 = 2 ... --> AF.IPv4 --> '%s' % AF.IPv4 'AF.IPv4' --> '%r' % AF.IPv4 '' --> '%d

[issue18606] Add statistics module to standard library

2013-08-14 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18606> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: '{:}'.format(AF.IPv4) is incorrect, but '{:10}'.format(AF.IPv4) behaves as it should. -- ___ Python tracker <http://bug

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Looks like Objects/unicodeobject.c needs the same enhancement that Modules/_json.c received: convert int/float subclasses into actual ints/floats before continuing. -- ___ Python tracker <http://bugs.python.

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Gotcha. I'm on it. -- assignee: -> ethan.furman ___ Python tracker <http://bugs.python.org/issue18738> ___ ___ Python-bug

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: The %-formatting needs to be handled by str, correct? What is '{:}' supposed to mean? -- ___ Python tracker <http://bugs.python.o

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Which is the same as '%s', yes? In that case, the current behavior of '{:}'.format(AF.IPv4) is correct, isn't it? -- ___ Python tracker <http:

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > I think that specifying __format__() would be best, except then you need to > decide what sort of format specification language you want to support, and > deal with all of the implementation details. Or,

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > For the format version, what gets called is: > > int_subclass.__format__('d'), which is int.__format__(int_subclass, > 'd'), which produces '1', assuming int(int_subclass) is 1

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > I assumed we'd want it to look like the str() version of itself, always. But > it's debatable. An IntEnum's str and repr should be (and any format or % codes that are the equivalent) the Enu

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Okay, I see your points. I can certainly agree with going with the str representation when no numeric code is specified. But, if a numeric code is specified (x, b, d, etc.) then the numeric value should be used. Agreed

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

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: On 08/14/2013 11:55 AM, Eli Bendersky wrote: > > I'm not sure I understand. The discrepancy between {:} and {:10} is clearly > a problem. Ah, you're right. -- ___ Python tracker <http://bugs

[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 sub

[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' --> '{:

[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 <http:

[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 i

[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 tr

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

2013-08-15 Thread Ethan Furman
Ethan Furman added the comment: +def __format__(self, *args, **kwargs): +return self.__class__._member_type_.__format__(self.value, *args, **kwargs) + With this in the Enum class all members simply forward formatting to the mixed-in type, meaning that IntEnum behaves exactly like

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

2013-08-15 Thread Ethan Furman
Ethan Furman added the comment: > Eli Bendersky added the comment: > Naturally, compatibility with % formatting is desired. '%s' is str, '%i' is > int(). Can we solve that one on this issue, or do we need to make another? -- _

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

2013-08-15 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > I think the answers should be: > > - Formats as int if the length of the format spec is >= 1 and it ends in > one of "bdoxX" (the int presentation types). Hmmm. How about defining the charac

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

2013-08-15 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: >> Ethan Furman added the comment: >> >>> Hmmm. How about defining the characters that will be supported for string >>> interpretation, and if there are any other >>> characters in fo

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

2013-08-15 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > But a datetime format string can end in "0", for example. > >>>> format(datetime.datetime.now(), '%H:%M:%S.00') > '20:25:27.00' Not a problem, because once the digi

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

2013-08-16 Thread Ethan Furman
Ethan Furman added the comment: Eric, please do not feel your time has been wasted. I greatly appreciate the knowledge you shared and I learned much. I feel very strongly that, as much as possible, an Enum should Just Work. Requiring users to write their own __format__ any time they create

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

2013-08-16 Thread Ethan Furman
Ethan Furman added the comment: This patch contains the previous patch, plus a fix and tests for %i, %d, and %u formatting, and tests only for %f formatting (nothing to fix there, but don't want it breaking in the future ;) . -- Added file: http://bugs.python.org/file31311/issue

[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-16 Thread Ethan Furman
Changes by Ethan Furman : -- assignee: -> ethan.furman ___ Python tracker <http://bugs.python.org/issue18745> ___ ___ Python-bugs-list mailing list Unsubscri

[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-16 Thread Ethan Furman
Ethan Furman added the comment: Tests look good to me. -- nosy: +barry, eli.bendersky stage: -> patch review ___ Python tracker <http://bugs.python.org/issu

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

2013-08-20 Thread Ethan Furman
Ethan Furman added the comment: Eli Bendersky added the comment: > > The whole point of IntEnum and replacing stdlib constants with it was > friendly str & repr out of the box. Sure, friendly str and repr plus an nice way to work them in code. > This means that "just

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

2013-08-20 Thread Ethan Furman
Ethan Furman added the comment: Eric V. Smith added the comment: > > this gives the (to me) surprising results of: > >>>> format(S.a) > 'S.a' >>>> format(S.a, '10') > 'S.a' >>>> format(S.a, '10s') >

[issue18788] Proof of concept: implicit call syntax

2013-08-20 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue18788> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2013-08-21 Thread Ethan Furman
Ethan Furman added the comment: Serhiy Storchaka added the comment: > > I'm proposing to split this issue on two issues. One for C-style formatting > (I guess everyone agree that '%i' % should return decimal > representation of its numerical value) and other

[issue18780] SystemError when formatting int subclass

2013-08-21 Thread Ethan Furman
Ethan Furman added the comment: I'll get my patch separated and over here when I get back home (on a business trip at the moment). -- ___ Python tracker <http://bugs.python.org/is

[issue17741] event-driven XML parser

2013-08-26 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker <http://bugs.python.org/issue17741> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17741] event-driven XML parser

2013-08-26 Thread Ethan Furman
Ethan Furman added the comment: Stefan Behnel wrote: > ... I still wonder why I'm the one writing all the patches ... I imagine for the same reasons that I offered to write Enum: I had definite ideas about how it should be, it is sometimes easier to explain with working code than wi

[issue18780] SystemError when formatting int subclass

2013-08-27 Thread Ethan Furman
Ethan Furman added the comment: Okay, simple fix, patch and tests attached. -- keywords: +patch nosy: +ncoghlan stage: -> patch review Added file: http://bugs.python.org/file31492/issue18780.stoneleaf.01.patch ___ Python tracker &l

[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-28 Thread Ethan Furman
Ethan Furman added the comment: The added tests for inf, -inf, and nan are good. The refactoring of the dictionary tests are not good. The reason is that before _json.c was fixed (issue18264) it would return the string value of an IntEnum instead of the string value of the IntEnum member&#

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

2013-08-28 Thread Ethan Furman
Ethan Furman added the comment: On 08/14/2013 09:27 PM, on PyDev, Nick Coghlan wrote: > For enums, I believe they should be formatted like their > base types (so !s and !r will show the enum name, anything without > coercion will show the value). I agree. While one of the big reaso

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

2013-08-31 Thread Ethan Furman
Ethan Furman added the comment: Final (hopefully ;) patch attached. Thanks, Eli, for your comments and help. -- Added file: http://bugs.python.org/file31538/issue18738.stoneleaf.04.patch ___ Python tracker <http://bugs.python.org/issue18

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

2013-08-31 Thread Ethan Furman
Ethan Furman added the comment: Thanks, Eric, for teaching me a bunch about format. :) -- ___ Python tracker <http://bugs.python.org/issue18738> ___ ___ Pytho

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

2013-08-31 Thread Ethan Furman
Ethan Furman added the comment: Okay, the final final patch. ;) -- Added file: http://bugs.python.org/file31539/issue18738.stoneleaf.05.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-31 Thread Ethan Furman
Ethan Furman added the comment: Eli Bendersky added the comment: > > Another issue is _intenum_converter. Ethan - do you think it belongs in the > enum module as a helper function or something of the sort? I'm fine with it being a non-public member of enum, although if we ha

[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-31 Thread Ethan Furman
Ethan Furman added the comment: Fixed formatting in patch. ;) -- Added file: http://bugs.python.org/file31541/issue18745.stoneleaf.02.patch ___ Python tracker <http://bugs.python.org/issue18

[issue18693] help() not helpful with enum

2013-09-01 Thread Ethan Furman
Ethan Furman added the comment: I've done some more investigation today but I can't tell if the issue is solely in help or if it's some wierd interaction between help and _EnumMeta. -- ___ Python tracker <http://bugs.pyt

[issue18693] help() not helpful with enum

2013-09-01 Thread Ethan Furman
Ethan Furman added the comment: Nope, not yet. And even a simple dummy metaclass with a custom __dir__ worked fine. -- ___ Python tracker <http://bugs.python.org/issue18

[issue18693] help() not helpful with enum

2013-09-01 Thread Ethan Furman
Ethan Furman added the comment: What I know for sure: 1) if something is added to dir() that does not live in __dict__, help() breaks. 2) if a certain something or some things are removed from dir(), help() breaks. I'm not yet certain which somethings apply

[issue18745] Test enum in test_json is ignorant of infinity value

2013-09-01 Thread Ethan Furman
Ethan Furman added the comment: >From my layman's perspective they are all not numbers -- you can't add 5 to >any of them and get a number back that is 5 more than you started with. By I have no problem with your proposed name -- I&#x

[issue16938] pydoc confused by __dir__

2013-09-02 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +eli.bendersky, ethan.furman ___ Python tracker <http://bugs.python.org/issue16938> ___ ___ Python-bugs-list mailing list Unsub

[issue16938] pydoc confused by __dir__

2013-09-03 Thread Ethan Furman
Ethan Furman added the comment: I wonder if it would be better to have inspect.classify_class_attrs be improved instead? -- ___ Python tracker <http://bugs.python.org/issue16

<    3   4   5   6   7   8   9   10   11   12   >