[issue22806] regrtest: add switch -c to run only modified tests

2015-10-02 Thread STINNER Victor
STINNER Victor added the comment: I'm now closing this issue because Antoine, Serhiy and me dislike the idea. > An alternate suggestion would be to allow filenames like > "Lib/test/test_foo.py" as arguments to regrtest. This sounds like a better plan. Please open a new issue if you still need

[issue22806] regrtest: add switch -c to run only modified tests

2015-10-02 Thread STINNER Victor
STINNER Victor added the comment: I added "python -m test --list-tests". It's not perfect but it's better than nothing :-p -- ___ Python tracker ___

[issue22806] regrtest: add switch -c to run only modified tests

2015-10-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1005573e6a74 by Victor Stinner in branch 'default': Issue #22806: Add ``python -m test --list-tests`` command to list tests. https://hg.python.org/cpython/rev/1005573e6a74 -- nosy: +python-dev ___ Python

[issue19624] Switch constants in the errno module to IntEnum

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- resolution: - rejected stage: needs patch - status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___

[issue22806] regrtest: add switch -c to run only modified tests

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: -ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22806 ___ ___ Python-bugs-list

[issue6377] distutils compiler switch ignored

2015-04-02 Thread Jean-Paul Calderone
Changes by Jean-Paul Calderone jean-p...@clusterhq.com: -- nosy: -exarkun ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6377 ___ ___

[issue21099] Switch applicable importlib tests to use PEP 451 API

2015-02-24 Thread Mark Lawrence
Mark Lawrence added the comment: To echo Brett's question, should this be closed, Eric? -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21099 ___

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-12-12 Thread Brett Cannon
Brett Cannon added the comment: Should this be closed, Eric? -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21099 ___ ___

[issue22806] regrtest: add switch -c to run only modified tests

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

[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Georg Brandl
New submission from Georg Brandl: A quick way to select only tests that are modified in the checkout. -- components: Tests files: regrtest_changed.diff keywords: patch messages: 230748 nosy: georg.brandl, pitrou priority: normal severity: normal status: open title: regrtest: add switch

[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Unfortunately this doesn't work with tests for pickle, json or tkinter. I'm afraid this feature would make false promise. Without careful check you can not be confident that all modified tests are selected. If you going to add this switch, it should emit

[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree this is more dangerous than useful. (even if you haven't modified a test it may still be impacted by some other change) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22806

[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Georg Brandl
Georg Brandl added the comment: Well, this is not meant as a comprehensive run ALL impacted tests because that is impossible in general :) An alternate suggestion would be to allow filenames like Lib/test/test_foo.py as arguments to regrtest. Then I could run without the switch using

[issue22806] regrtest: add switch -c to run only modified tests

2014-11-06 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22806 ___ ___

[issue6377] distutils compiler switch ignored

2014-07-09 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: +Python 3.4, Python 3.5 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6377 ___

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-07-04 Thread Mark Lawrence
Mark Lawrence added the comment: Can we have a patch review please as #18864 is dependent on this. -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21099 ___

Re: Yet Another Switch-Case Syntax Proposal

2014-04-10 Thread Lucas Malor
if the switched expression is an element of the tuple. If you want to match exactly a tuple, you have simply to put it into another tuple of length 1. Tricky but too much rare to care about. To recap: switch_stmt ::= switch expression case expression_list : suite (case | elcase

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Marco S.
On 3 April 2014 20:12, Ian Kelly ian.g.kelly-at-gmail.com | python-list@python.org| dnl5yyr...@sneakemail.com wrote: Use this instead [of continue]: switch day case in (Mon, Tue, Wed, Thu, Fri): go_to_work = True day_type = ferial if day in (Tue, Thu): lunch_time

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 3:49 AM, Marco S. elbar...@gmail.com wrote: switch day case in briefing_days: lunch_time = datetime.time(11, 30) meeting_time = datetime.time(12, 30) case not in briefing_days + festive_days: lunch_time = datetime.time(12) meeting_time = datetime.time

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Michael Torrie
altogether assumes == and does the above. In either case (pardon the pun), the check will be done only if the preceding case was false. An 'else' clause is effectively equivalent to a 'case' that's always true. Adds only one keyword to the language (switch is gone), and adds an edge case to parsing

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Ian Kelly
On Sun, Apr 6, 2014 at 11:49 AM, Lucas Malor 3kywjyd...@snkmail.com wrote: On 3 April 2014 20:12, Ian Kelly ian.g.kelly-at-gmail.com |python-list@python.org| dnl5yyr...@sneakemail.com wrote: Use this instead [of continue]: switch day case in (Mon, Tue, Wed, Thu, Fri): go_to_work = True

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 6:13 AM, Michael Torrie torr...@gmail.com wrote: On 04/06/2014 12:07 PM, Chris Angelico wrote: This has a slight oddity of parsing (in that an expression can normally have a comparison in it); if you really want to use the result of a comparison inside a case block,

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Steven D'Aprano
On Thu, 03 Apr 2014 15:11:38 -0400, Terry Reedy wrote: On 4/3/2014 12:02 PM, Lucas Malor wrote: A more suitable place to propose this would be the python-ideas mailing list. You're right. I posted here because this list was linked by PEP 1. But now that I read more there's also

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Steven D'Aprano
On Thu, 03 Apr 2014 11:23:39 -0700, Ethan Furman wrote: On 04/03/2014 09:02 AM, Lucas Malor wrote: In reply to Ian Kelly: Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example switch day casein

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Marko Rauhamaa
Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example No, it is never useful, it never was. It came into being by accident, a design bug turned into an advertised feature. switch day casein (Monday

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Ian Kelly
On Apr 4, 2014 3:51 AM, Marko Rauhamaa ma...@pacujo.net wrote: switch day casein (Monday, Thursday, Wednesday, Tuesday, Friday): gotowork = True continue casein (Monday, Thursday, Wednesday, Tuesday, Friday): daytype = ferial casein (Saturday, Sunday) daytype

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Devin Jeanpierre
If one were to add switch into Python, wouldn't it be desirable to make a pattern matching switch (think the match or case construct from Haskell or ML)? Python currently has poor support for union/sum types in general, not just enumerations. It feels weird to add better support for enumerations

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Marko Rauhamaa
Ian Kelly ian.g.ke...@gmail.com: On Apr 4, 2014 3:51 AM, Marko Rauhamaa ma...@pacujo.net wrote: switch: local_sabbath() case (1, 2, 3) as sabbath: ... case 6: ... else: ... [...] What's wrong with the much more natural switch local_sabbath():? Consider

Re: Yet Another Switch-Case Syntax Proposal

2014-04-04 Thread Ian Kelly
On Fri, Apr 4, 2014 at 10:44 AM, Marko Rauhamaa ma...@pacujo.net wrote: Consider: switch local_sabbath():# bad case (1, 2, 3) as sabbath: ... I'm not overly fond of that either. That's why I liked the OP's choice to put the first case in the switch statement. Now

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Ian Kelly
On Wed, Apr 2, 2014 at 7:06 PM, Steven D'Aprano st...@pearwood.info wrote: If we're going to add switch and case keywords, how about we also add of? Then we can write: switch x case of a, b, c: # x equals one of a, b or c case of d, e, f: # x equals one of d, e or f case in g, h, i

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Lucas Malor
. But I think that the more practical and unambiguous solution is to introduce also casein as a new keyword. So if you want to test a string: switch mystring case -h: print_usage() case --version print_version() If you want to test against membership: switch mychar casein aeiou

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Ian Kelly
. It already exists: import collections.abc isinstance([1,2,3], collections.abc.Iterable) True Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example switch day casein (Monday, Thursday, Wednesday, Tuesday

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Ethan Furman
On 04/03/2014 09:02 AM, Lucas Malor wrote: In reply to Ian Kelly: Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example switch day casein (Monday, Thursday, Wednesday, Tuesday, Friday): gotowork

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Terry Reedy
On 4/3/2014 12:02 PM, Lucas Malor wrote: A more suitable place to propose this would be the python-ideas mailing list. You're right. I posted here because this list was linked by PEP 1. But now that I read more there's also python-ideas listed. Let me know if I have to continue there

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 5:12 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Use this instead: switch day case in (Mon, Tue, Wed, Thu, Fri): go_to_work = True day_type = ferial if day in (Tue, Thu): lunch_time = datetime.time(11, 30) meeting_time = datetime.time(12

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Mark Lawrence
On 02/04/2014 15:53, Lucas Malor wrote: Hi all. I would proposeto you all a switch-case syntax for Python. I already read PEP 3103 and I'm not completely satisfied by any of the proposed solutions. This is my proposal: switch_stmt ::= switch identifier case expression_list : suite (case

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 10:03 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: Please don't take this personally, but there's more chance of me being the first ever World President than of anybody getting a switch/case statement past the BDFL. The language in PEP 3103 (written by Guido) doesn't

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread MRAB
On 2014-04-03 19:23, Ethan Furman wrote: On 04/03/2014 09:02 AM, Lucas Malor wrote: In reply to Ian Kelly: Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example switch day casein (Monday, Thursday

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Ethan Furman
switch day casein (Monday, Thursday, Wednesday, Tuesday, Friday): gotowork = True continue casein (Monday, Thursday, Wednesday, Tuesday, Friday): daytype = ferial casein (Saturday, Sunday) daytype = festive Absolutely not. Currently, the 'continue' key word means stop

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 1:04 PM, MRAB pyt...@mrabarnett.plus.com wrote: I thought [continue] went to the end of the loop, but because it's a loop, it just wraps around back to the top... It goes to the bottom of the loop, and then the loop condition may or may not send it to the top of the loop.

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Ethan Furman
On 04/03/2014 08:09 PM, Chris Angelico wrote: On Fri, Apr 4, 2014 at 1:04 PM, MRAB pyt...@mrabarnett.plus.com wrote: I thought [continue] went to the end of the loop, but because it's a loop, it just wraps around back to the top... It goes to the bottom of the loop, and then the loop

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Chris Angelico
On Fri, Apr 4, 2014 at 2:13 PM, Ethan Furman et...@stoneleaf.us wrote: On 04/03/2014 08:09 PM, Chris Angelico wrote: On Fri, Apr 4, 2014 at 1:04 PM, MRAB pyt...@mrabarnett.plus.com wrote: I thought [continue] went to the end of the loop, but because it's a loop, it just wraps around back to

Yet Another Switch-Case Syntax Proposal

2014-04-02 Thread Lucas Malor
Hi all. I would proposeto you all a switch-case syntax for Python. I already read PEP 3103 and I'm not completely satisfied by any of the proposed solutions. This is my proposal: switch_stmt ::= switch identifier case expression_list : suite (case expression_list : suite)* [else

Re: Yet Another Switch-Case Syntax Proposal

2014-04-02 Thread Ian Kelly
On Wed, Apr 2, 2014 at 8:53 AM, Lucas Malor 3kywjyd...@snkmail.com wrote: Hi all. I would proposeto you all a switch-case syntax for Python. I already read PEP 3103 and I'm not completely satisfied by any of the proposed solutions. This is my proposal: A more suitable place to propose

Re: Yet Another Switch-Case Syntax Proposal

2014-04-02 Thread Chris Angelico
On Thu, Apr 3, 2014 at 1:53 AM, Lucas Malor 3kywjyd...@snkmail.com wrote: For example, in a switch x statement, the code case iterable: is identical to if x in iterable: (or elif etc). So if you want to perform the same case block for more than one value, you have only to specify a tuple

Re: Yet Another Switch-Case Syntax Proposal

2014-04-02 Thread Steven D'Aprano
On Thu, 03 Apr 2014 08:50:47 +1100, Chris Angelico wrote: On Thu, Apr 3, 2014 at 1:53 AM, Lucas Malor 3kywjyd...@snkmail.com wrote: For example, in a switch x statement, the code case iterable: is identical to if x in iterable: (or elif etc). So if you want to perform the same case block

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-03-29 Thread Eric Snow
with equivalent tests that make use of specs directly. -- assignee: eric.snow components: Tests messages: 215147 nosy: brett.cannon, eric.snow, ncoghlan priority: normal severity: normal stage: needs patch status: open title: Switch applicable importlib tests to use PEP 451 API type: enhancement

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-03-29 Thread Nick Coghlan
Nick Coghlan added the comment: New tests please - we want to make sure these keep working unless/until we reach agreement to actually remove them, and I'd prefer not to raise any new barriers to migration from Python 2.6/7 until 3.6 at the earliest :) --

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-03-29 Thread Eric Snow
Eric Snow added the comment: Agreed. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21099 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21099] Switch applicable importlib tests to use PEP 451 API

2014-03-29 Thread Eric Snow
Eric Snow added the comment: Here's a patch. In most spots I'm left things alone. There is a comment in the docstring for test_abc.SourceOnlyLoaderTests about reload-related tests and module_for_loader (which is deprecated now). I'm not going to worry about that for now. --

[issue6145] distutils.extension.read_setup_file misinterprets -C switch

2014-03-19 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6145 ___

Re: SSH/Telnet program to Router/switch

2014-02-27 Thread Rodrick Brown
Sent from my iPhone On Feb 20, 2014, at 5:59 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech Łysiak έγραψε: On 19.02.2014 09:14, Sujith S wrote: Hi, I am new to programming and python. I am looking for a

Re: SSH/Telnet program to Router/switch

2014-02-25 Thread Ferrous Cranus
Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech Łysiak έγραψε: On 19.02.2014 09:14, Sujith S wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using

SSH/Telnet program to Router/switch

2014-02-19 Thread Sujith S
Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect available in python as well or need to use some other method ? Regards Sujith --

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Chris Angelico
On Wed, Feb 19, 2014 at 7:14 PM, Sujith S sujith...@gmail.com wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect available in python as well or need to use

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Wojciech Łysiak
On 19.02.2014 09:14, Sujith S wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect available in python as well or need to use some other method ?

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Johannes Schneider
On 19.02.2014 09:14, Sujith S wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect available in python as well or need to use some other method ? Regards Sujith

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Roy Smith
In article d343f9af-54f2-4709-9a99-1ad5708c1...@googlegroups.com, Sujith S sujith...@gmail.com wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Chris Angelico
On Thu, Feb 20, 2014 at 12:35 AM, Roy Smith r...@panix.com wrote: As far as I know, fabric only works with ssh. If you are forced to use telnet to talk to legacy equipment, that's another problem. If it's telnet, it's likely to be a pretty simple protocol. All you really need is the socket

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Roy Smith
In article roy-f02fd5.08350019022...@news.panix.com, Roy Smith r...@panix.com wrote: in conjunction with a near command-line driver tool called fab Typo there: near should have been neat. [this is why I love wikis] -- https://mail.python.org/mailman/listinfo/python-list

Re: SSH/Telnet program to Router/switch

2014-02-19 Thread William Ray Wing
On Feb 19, 2014, at 3:14 AM, Sujith S sujith...@gmail.com wrote: Hi, I am new to programming and python. I am looking for a python script to do ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send. Do we have expect available in python as well or need to use

[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: An option is to rename the C errno module to _errno and leave it unchanged, and provide a Python errno module which enum API. I agree it sounds reasonable. Using enum for errno should not slow down Python startup time. enum imports OrderedDict from

[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Note that even if errno is migrated to enum, OSErrors raised by the interpreter will still have a raw int errno... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624

[issue19624] Switch constants in the errno module to IntEnum

2013-11-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: I'm not sure whether changing the errno module to use enums would be conceptually correct: enums declare a fixed set of permitted values, but errno values can be any integer, are platform dependent and are sometimes not unique (e.g. EWOULDBLOCK = EAGAIN,

[issue19624] Switch constants in the errno module to IntEnum

2013-11-26 Thread STINNER Victor
STINNER Victor added the comment: I don't know if it's possible/convinient, but it would be nice to have a str() method using os.strerror(). Or maybe a method with a different name. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org

[issue19624] Switch constants in the errno module to IntEnum

2013-11-26 Thread STINNER Victor
STINNER Victor added the comment: This is not so easy issue because the errno module is not pure Python module. ;) An option is to rename the C errno module to _errno and leave it unchanged, and provide a Python errno module which enum API. Then slowly errno module should be used instead

[issue19624] Switch constants in the errno module to IntEnum

2013-11-26 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- keywords: -easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___ ___ Python-bugs-list

[issue19624] Switch constants in the errno module to IntEnum

2013-11-25 Thread Chris
Chris added the comment: I would be interested in tackling this as a first patch, can you give me some more information? -- nosy: +chrishood ___ 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: 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 ___ ___

[issue19624] Switch constants in the errno module to IntEnum

2013-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is not so easy issue because the errno module is not pure Python module. ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___

[issue19624] Switch constants in the errno module to IntEnum

2013-11-25 Thread Chris
Chris added the comment: I think I'll look for some other issues, this one looks a bit deep for a first patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___

[issue19624] Switch constants in the errno module to IntEnum

2013-11-24 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +easy type: - enhancement versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19624 ___

[issue19624] Switch constants in the errno module to IntEnum

2013-11-16 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: It will be good to switch constants in the errno module to IntEnum. -- components: Extension Modules, Library (Lib) messages: 203035 nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka priority: normal severity: normal stage: needs patch

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

2013-08-31 Thread Roundup Robot
Roundup Robot added the comment: New changeset 038543d34166 by Eli Bendersky in branch 'default': Switch the AF_* and SOCK_* constants in the socket module to IntEnum. http://hg.python.org/cpython/rev/038543d34166 -- nosy: +python-dev resolution: - fixed stage: patch review - committed

[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 had a place for

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

2013-08-31 Thread Eli Bendersky
Eli Bendersky added the comment: On Sat, Aug 31, 2013 at 3:18 PM, Ethan Furman rep...@bugs.python.orgwrote: 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

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

2013-08-30 Thread Eli Bendersky
Eli Bendersky added the comment: [Thanks, Guido] Attaching patch with SOCK_* constants converted as well. The module globals are currently walked twice, once to extract AF_* and once SOCK_*. This is not a real performance problem, but should we fold it into a single loop that collects two

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

2013-08-30 Thread Guido van Rossum
Guido van Rossum added the comment: I prefer two prettier loops over one less pretty one in this case. No opinion about _intenum_converter yet. (IMO refactoring can always be lazy, i.e. after you have multiple copies of the same code there's time to consider whether you should unify them and

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

2013-08-26 Thread Guido van Rossum
Guido van Rossum added the comment: Looks good. Go ahead and convert the rest of the socket constants. Then we can consider other modules, e.g. select and os. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18720

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

2013-08-25 Thread Eli Bendersky
Eli Bendersky added the comment: Serhiy, patch 5 addresses your latest review. Thanks. As for _family_converter, let's see how common this really becomes. Based on one use-case I wouldn't add it to Enum itself. But if we see it gets repeated in many places, we can. -- Added file:

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

2013-08-16 Thread Charles-François Natali
Charles-François Natali added the comment: I've just had a quick look at the patch, but from what I can see, socket.getaddrinfo() will return a raw integer for the family, and not an AddressFamily instance. That's unfortunate. -- ___ Python tracker

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

2013-08-16 Thread Eli Bendersky
Eli Bendersky added the comment: Great catch, Charles-François, thanks. It's actually an interesting example in favor of the approach - it's very nice to see descriptive family names in the data returned by getaddrinfo, instead of obtuse numeric values. The attached patch fixes it in a

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

2013-08-16 Thread Eli Bendersky
Eli Bendersky added the comment: Looks nice: for t in socket.getaddrinfo('www.google.com', 'http'): ... t ... (AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.112', 80)) (AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.112', 80)) (AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.116',

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

2013-08-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Besides some nitpicks which I have left on Rietveld the patch LGTM. I guess the _family_converter idiom will be popular enough. Perhaps we will add some helper just to the Enum class. -- ___ Python tracker

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

2013-08-16 Thread Charles-François Natali
Charles-François Natali added the comment: The attached patch fixes it in a similar vein to what was done for the family accessor: getaddrinfo is overridden in Python and does the necessary conversion. Am I the only one thinking that wrapping every C function with a Python counterpart to

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

2013-08-16 Thread Christian Heimes
Christian Heimes added the comment: I wonder how much of an performance issue these wrappers are going to be. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18720 ___

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

2013-08-16 Thread Eli Bendersky
Eli Bendersky added the comment: Charles-François: unfortunately, the alternative seems to be even more tedious and error prone. Internally, socketmodule.c really uses ints all over the place. Changing that to use IntEnum objects from Python would be very tedious and touch a lot more code.

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

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What about SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18720 ___

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

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not really thrilled by the current implementation. The way it is done leads to duplication among socket constants. Also, if I create a socket from a numeric value (because a well-known socket family is known yet known by Python), then socket.family will

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

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18720 ___ ___ Python-bugs-list mailing

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: I'm not really thrilled by the current implementation. The way it is done leads to duplication among socket constants. Can you clarify which duplication you mean specifically? In the code review tool, Serhiy proposed that instead of listing all the constants

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: What about SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW? This is a proof of concept. As I mentioned in the original message starting this issue - the SOCK_* constants will get the same treatment as AF_* constants, once we decide what the right treatment is.

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

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Can you clarify which duplication you mean specifically? In the code review tool, Serhiy proposed that instead of listing all the constants explicitly in the Python code, we can just do: AddressFamily = IntEnum('AddressFamily', {name: value

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

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm surprised that test_repr is not failed. '%i' % socket.AddressFamily.AF_INET returns 'AddressFamily.AF_INET' instead of '2' as I expected. Is not this a bug in IntEnum implementation? -- ___ Python tracker

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Attaching a new patch that uses Serhiy's suggestion to avoid the duplication, and uses Antoine's suggestion to keep socket.family working even if the family is an unknown numeric constant. Note that the latter is challenging to test - I need families the OS

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 6:24 AM, Serhiy Storchaka rep...@bugs.python.orgwrote: Serhiy Storchaka added the comment: I'm surprised that test_repr is not failed. '%i' % socket.AddressFamily.AF_INET returns 'AddressFamily.AF_INET' instead of '2' as I expected.

[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 rep...@bugs.python.org http://bugs.python.org/issue18720 ___ ___ Python-bugs-list mailing list

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

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: The manual list of AF_ prefixes looks ugly. We are going to run into the same problem for every module. How about an additional constructor that takes a name, dict and string prefix? class IntEnum(int, Enum): @classmethod def from_moduledict(cls,

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Christian, this is an interesting idea - but I suggest we review it once we actually get to convert many modules. For the time being the manual listing is gone in the recent patch, and for a number of constant families in the same module (i.e. SOCK_* that will

<    1   2   3   4   5   6   7   8   >