Re: PEP 450 Adding a statistics module to Python

2013-08-14 Thread Steven D'Aprano
On Tue, 13 Aug 2013 20:14:55 +0200, Wolfgang Keller wrote: I am seeking comments on PEP 450, Adding a statistics module to Python's standard library: I don't think that you want to re-implement RPy. I never suggested re-implementing RPy. When you read the PEP, you will see that this

Re: Getting a value that follows string.find()

2013-08-14 Thread Steven D'Aprano
On Tue, 13 Aug 2013 16:03:46 -0700, englishkevin110 wrote: On Tuesday, August 13, 2013 5:58:07 PM UTC-5, Joel Goldstick wrote: [fixing Joel's top-posting] On Tue, Aug 13, 2013 at 6:51 PM, wrote: I know the title doesn't make much sense, but I didnt know how to explain my problem.

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-14 Thread Steven D'Aprano
On Tue, 13 Aug 2013 15:34:45 +, Prasad, Ramit wrote: Michael Torrie wrote: [...] However I know of no phone or network that won't let you use longer messages; multiple SMS packets are used and most phone paste them back together. So no there's nothing that anyone needs to change to use

Re: Am I not seeing the Error?

2013-08-14 Thread Joshua Landau
On 14 August 2013 02:20, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ned Batchelder wrote: Everyone: this program seems to be a direct and misguided transliteration from a bash script. Not a particularly well-written bash script, either -- it's full of superfluous uses of 'cat'.

Re: python and displaying on 10 bit monitors

2013-08-14 Thread Nobody
On Tue, 13 Aug 2013 05:25:34 -0700, rlkling wrote: Or, asking another way, are there any python libraries that display images to 10 bit monitors as 10 bit images, and not scaled to 8 bit? This should be possible using PyOpenGL and GLUT, with: glutInitDisplayString(red=10 green=10

Re: Pair of filenos read/write each other?

2013-08-14 Thread Nobody
On Tue, 13 Aug 2013 16:10:41 -0700, Jack Bates wrote: Is there anything like os.pipe() where you can read/write both ends? There's socket.socketpair(), but it's only available on Unix. Windows doesn't have AF_UNIX sockets, and anonymous pipes (like the ones created by os.pipe()) aren't

Re: Pair of filenos read/write each other?

2013-08-14 Thread Antoine Pitrou
Nobody nobody at nowhere.com writes: On Tue, 13 Aug 2013 16:10:41 -0700, Jack Bates wrote: Is there anything like os.pipe() where you can read/write both ends? There's socket.socketpair(), but it's only available on Unix. Windows doesn't have AF_UNIX sockets, and anonymous pipes (like

Re: .split() Qeustion

2013-08-14 Thread Alister
On Tue, 13 Aug 2013 22:12:56 -0700, Gary Herron wrote: On 08/13/2013 09:51 PM, eschneide...@comcast.net wrote: How can I use the '.split()' method (am I right in calling it a method?) without instead of writing each comma between words in the pie list in the following code? Also, is there a

Verifying Variable value

2013-08-14 Thread chandan kumar
Hi , Is there a way to validate variable values while debugging any python code.Run below example  in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing. In C# or some other tools we can verify each statement and values. 

Re: .split() Qeustion

2013-08-14 Thread Joshua Landau
On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: On Tue, 13 Aug 2013 22:12:56 -0700, Gary Herron wrote: On 08/13/2013 09:51 PM, eschneide...@comcast.net wrote: How can I use the '.split()' method (am I right in calling it a method?) without instead of writing each comma

Re: Verifying Variable value

2013-08-14 Thread Krishnan Shankar
Hi Chandan, Python has built-in module called pdb which can be used for debugging. Importing it in the right place will be like setting break point in code and will change the execution to debugging mode. We can use different debugging commands ((n)ext, (c)ontinue, (s)tep etc) to evaluate

Re: .split() Qeustion

2013-08-14 Thread Peter Otten
Joshua Landau wrote: On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: On Tue, 13 Aug 2013 22:12:56 -0700, Gary Herron wrote: On 08/13/2013 09:51 PM, eschneide...@comcast.net wrote: How can I use the '.split()' method (am I right in calling it a method?) without instead of

Re: .split() Qeustion

2013-08-14 Thread Joshua Landau
On 14 August 2013 12:45, Peter Otten __pete...@web.de wrote: Joshua Landau wrote: On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: I would agree with the last statement. Please write list definitions as lists rather than taking a short-cut to save a few key presses That's

Re: Verifying Variable value

2013-08-14 Thread Dave Angel
chandan kumar wrote: Hi , Is there a way to validate variable values while debugging any python code.Run below example  in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing. In C# or some other tools we can verify

Re: Am I not seeing the Error?

2013-08-14 Thread Chris Angelico
On Wed, Aug 14, 2013 at 7:59 AM, Joshua Landau jos...@landau.ws wrote: On 14 August 2013 02:20, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ned Batchelder wrote: Everyone: this program seems to be a direct and misguided transliteration from a bash script. Not a particularly

Re: Am I not seeing the Error?

2013-08-14 Thread Joshua Landau
On 14 August 2013 13:07, Chris Angelico ros...@gmail.com wrote: On Wed, Aug 14, 2013 at 7:59 AM, Joshua Landau jos...@landau.ws wrote: What's wrong with cat? Sure it's superfluous but what makes it *bad*? Personally I often prefer the pipe cat x | y form to x y... or y x. What's the use

Re: Am I not seeing the Error?

2013-08-14 Thread Roy Smith
In article mailman.573.1376482061.1251.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Aug 14, 2013 at 7:59 AM, Joshua Landau jos...@landau.ws wrote: On 14 August 2013 02:20, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ned Batchelder wrote: Everyone: this

Re: Verifying Variable value

2013-08-14 Thread Krishnan Shankar
You can even use logging module in python to validate the variable values. You can import the module and use any of the following levels in your program import logging logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG For more you can refer to,

Reading log and saving data to DB

2013-08-14 Thread Guy Tamir
Hi all, I have a Ubuntu server running NGINX that logs data for me. I want to write a python script that reads my customized logs and after a little rearrangement save the new data into my DB (postgresql). The process should run about every 5 minutes and i'm expecting large chunks of data on

Re: .split() Qeustion

2013-08-14 Thread Alister
On Wed, 14 Aug 2013 11:31:01 +0100, Joshua Landau wrote: On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: On Tue, 13 Aug 2013 22:12:56 -0700, Gary Herron wrote: On 08/13/2013 09:51 PM, eschneide...@comcast.net wrote: How can I use the '.split()' method (am I right in calling

Re: Reading log and saving data to DB

2013-08-14 Thread mar...@python.net
On Wed, Aug 14, 2013, at 09:18 AM, Guy Tamir wrote: Hi all, I have a Ubuntu server running NGINX that logs data for me. I want to write a python script that reads my customized logs and after a little rearrangement save the new data into my DB (postgresql). The process should run about

many constructors in a class?

2013-08-14 Thread climb65
Hello, here is a small basic question : Is it possible to have more than one constructor (__init__ function) in a class? For instance, to create an object with 2 different ways? If my memory is good, I think that with C++ it is possible. Thanks for your answer. --

Re: Digging into multiprocessing

2013-08-14 Thread Demian Brecht
Awesome, thanks for the detailed response Chris. On Tue, Aug 13, 2013 at 8:03 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Aug 13, 2013 at 12:17 AM, Demian Brecht demianbre...@gmail.com wrote: Hi all, Some work that I'm doing atm is in some serious need of parallelization. As such,

Re: .split() Qeustion

2013-08-14 Thread wxjmfauth
Le mercredi 14 août 2013 13:55:23 UTC+2, Joshua Landau a écrit : On 14 August 2013 12:45, Peter Otten __pete...@web.de wrote: Joshua Landau wrote: On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: I would agree with the last statement. Please write list definitions

Re: many constructors in a class?

2013-08-14 Thread Phil Le Bienheureux
2013/8/14 climb65 clim...@laposte.net Hello, here is a small basic question : Is it possible to have more than one constructor (__init__ function) in a class? For instance, to create an object with 2 different ways? If my memory is good, I think that with C++ it is possible. Thanks for

Re: many constructors in a class?

2013-08-14 Thread duncan smith
On 14/08/13 15:16, climb65 wrote: Hello, here is a small basic question : Is it possible to have more than one constructor (__init__ function) in a class? For instance, to create an object with 2 different ways? If my memory is good, I think that with C++ it is possible. Thanks for your

ANN: Pyrolite 1.12 - native pickle and Pyro client library for java and .net

2013-08-14 Thread Irmen de Jong
Hi, I'd like to announce Pyrolite 1.12, a tiny (~60k) pickle and Pyro client library for Java and .NET. Question: what is a java/.net library doing in this newsgroup? Answer 1: This library is meant to connect a Java or .NET program to Python in a very simple way, using the Pyro protocol. Pyro

Re: Getting a value that follows string.find()

2013-08-14 Thread John Gordon
In 40816fed-38d4-4baa-92cc-c80cd8feb...@googlegroups.com englishkevin...@gmail.com writes: I know the title doesn't make much sense, but I didnt know how to explain my problem. Anywho, I've opened a page's source in URLLIB starturlsource = starturlopen.read() string.find(starturlsource,

RE: Verifying Variable value

2013-08-14 Thread Prasad, Ramit
chandan kumar wrote: Hi , Is there a way to validate variable values while debugging any python code.Run below example  in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing. In C# or some other tools we can

Re: .split() Qeustion

2013-08-14 Thread random832
On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number of hard coded '\n' one can find in Python code when the portable (here win) os.linesep '\r\n' exists. Because high-level code isn't supposed to use the os module directly.

Re: .split() Qeustion

2013-08-14 Thread Chris Angelico
On Wed, Aug 14, 2013 at 6:05 PM, random...@fastmail.us wrote: On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number of hard coded '\n' one can find in Python code when the portable (here win) os.linesep '\r\n' exists. Because

Re: .split() Qeustion

2013-08-14 Thread Tim Chase
On 2013-08-14 18:14, Chris Angelico wrote: On Wed, Aug 14, 2013 at 6:05 PM, random...@fastmail.us wrote: On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number of hard coded '\n' one can find in Python code when the portable (here win)

Re: .split() Qeustion

2013-08-14 Thread Skip Montanaro
On Wed, Aug 14, 2013 at 12:05 PM, random...@fastmail.us wrote: Because high-level code isn't supposed to use the os module directly. That seems a bit extreme. One would hope that Guido and the rest of the crew created the os module so people would use it instead of resorting to other lower

Re: .split() Qeustion

2013-08-14 Thread Chris Angelico
On Wed, Aug 14, 2013 at 6:29 PM, Tim Chase python.l...@tim.thechases.com wrote: On 2013-08-14 18:14, Chris Angelico wrote: On Wed, Aug 14, 2013 at 6:05 PM, random...@fastmail.us wrote: On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number

Re: many constructors in a class?

2013-08-14 Thread Beth McNany
On Wed, Aug 14, 2013 at 10:16 AM, climb65 clim...@laposte.net wrote: Hello, here is a small basic question : Is it possible to have more than one constructor (__init__ function) in a class? For instance, to create an object with 2 different ways? If my memory is good, I think that with C++

Re: Verifying Variable value

2013-08-14 Thread Terry Reedy
On 8/14/2013 12:36 PM, Prasad, Ramit wrote: chandan kumar wrote: Is there a way to validate variable values while debugging any python code. In addition to pdb, I would imagine most Python IDEs would support debugging in this manner. Idle also has a debugger. It uses the same bdb base

Re: .split() Qeustion

2013-08-14 Thread Terry Reedy
On 8/14/2013 1:05 PM, random...@fastmail.us wrote: On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number of hard coded '\n' one can find in Python code when the portable (here win) os.linesep '\r\n' exists. Because high-level code isn't

Re: PEP 450 Adding a statistics module to Python

2013-08-14 Thread CM
On Friday, August 9, 2013 9:10:18 PM UTC-4, Steven D'Aprano wrote: I am seeking comments on PEP 450, Adding a statistics module to Python's standard library: I think it's a very good idea. Good PEP points, too. I hope it happens. -- http://mail.python.org/mailman/listinfo/python-list

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

2013-08-14 Thread Eric Snow
Eric Snow added the comment: Yep. In 2.7 and 3.2 the PyImport_ExecCodeModuleEx() function in Python/importlib.c returns the module found in sys.modules. Here is a patch. I suppose this should be fixed in 2.7 as well. Thoughts? -- keywords: +patch stage: - patch review Added file:

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

[issue14012] Misc tarfile fixes

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Lets push it. Lars? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14012 ___ ___ Python-bugs-list mailing

[issue18685] Restore re performance to pre-PEP393 level

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using #include _sre.c in _sre.c looks weird. Instead of huge sections delimited by #ifdef SRE_RECURSIVE, I would prefer something similar to the stringlib. .h template files included more than once. I also expect shorter files: _sre.c is close to 4000

[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

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
New submission from raymontag: Hello, I would like to see an implementation for SSL/TLS pinning in the sll module of the standard library. At this moment it's only possible to give the client a CAcert and check if the server's certificate is signed with this CA by creating a ssl.Context

[issue13647] Python SSL stack doesn't securely validate certificate (as client)

2013-08-14 Thread Christian Heimes
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13647 ___ ___

[issue15464] ssl: add set_msg_callback function

2013-08-14 Thread Christian Heimes
Changes by Christian Heimes li...@cheimes.de: -- assignee: - christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15464 ___ ___

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: TLS cert pinning should be possible with the implementation of #18293 -- nosy: +christian.heimes, giampaolo.rodola, janssen, pitrou stage: - needs patch versions: +Python 3.4 ___ Python tracker

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Yep, that's exactly what I meant :) -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18735 ___

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: If you want to check for a specific server certificate, then I guess it should be enough to expose the cert's fingerprint in the data returned by getpeercert(). -- ___ Python tracker rep...@bugs.python.org

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: getpeercert() doesn't return Subject Public Key Info yet. It's on my TODO list. Chrome uses SPKI (PK algo + mod + exp) to pin certs, https://www.imperialviolet.org/2011/05/04/pinning.html -- ___ Python tracker

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Yeah, this was my first idea, too. Are there at this moment other possibilities to implement pinning myself with the options the module provides me? -- ___ Python tracker rep...@bugs.python.org

[issue18736] Invalid charset in HTML pages inside documentation in CHM format

2013-08-14 Thread Basil Peace
New submission from Basil Peace: HTML pages inside CHM documentation use the following tag to set applied character set: meta http-equiv=Content-Type content=text/html; charset=iso8859_1 / `iso8859_1` is neither valid character set according to IANA registry nor is recognized by most

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Are there at this moment other possibilities to implement pinning myself with the options the module provides me? I don't think so. Perhaps you could use the serialNumber, but I'm not sure how safe it is, even when restricting to a single CA cert. --

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: sha256(conn.getpeercert(True)) works until the cert gets e.g. more SAN fields. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18735 ___

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: That's not a good idea, a serial number could be faked. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18735 ___

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: sha256(conn.getpeercert(True)) works until the cert gets e.g. more SAN fields. Indeed, that's simply comparing the certificate by binary value. At this point you don't even need a CA anymore, I guess :-) -- ___

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I have added documentation now so I think it is ready to merge (except for a change to Makefile). Good for me. This is a very nice addition! -- ___ Python tracker rep...@bugs.python.org

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Great, that matches my needs exactly -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18735 ___ ___ Python-bugs-list

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, good point. My only issue with the patch is that www.python.org will be resolved for every test method, even those that don't use remote_addr. This will make test_timeout unnecessarily slower. -- ___ Python

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- assignee: ncoghlan - neologix stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16463 ___

[issue18731] Increased test coverage for uu and telnet

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18731 ___ ___ Python-bugs-list

[issue18727] test for writing dictionary rows to CSV

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: You can probably use a StringIO for the file object, no need to create a temporary file. -- nosy: +pitrou stage: - patch review versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org

[issue18736] Invalid charset in HTML pages inside documentation in CHM format

2013-08-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18736 ___ ___

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

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can do this in the setUpClass() method. Or we can wrap the resolve_address() method with the @functools.lru_cache() decorator. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org

[issue18606] Add statistics module to standard library

2013-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: Steven: were you planning to start a discussion thread on python-dev for PEP 450? I see that there's some activity on python-list and on python-ideas, but I think most core devs would expect the main discussions to happen on the python-dev mailing list.

[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

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Christian Heimes
New submission from Christian Heimes: ABCs are missing one important introspection feature. They have no API to get registered virtual subclasses. The patch implements a new method get_virtual_subclasses(recurse=False). ABC.get_virtual_subclasses() returns the direct virtual subclasses of an

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure recurse is a relevant distinction here. A subclass of a subclass is still a subclass. Virtual subclasses should not be different. At the very least, if recurse is kept, I would expect it to be True by default. -- nosy: +pitrou

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Another problem is what happens when an implementation uses non-virtual inheritance: issubclass(collections.UserDict, collections.abc.Mapping) True collections.UserDict in collections.abc.Mapping.get_virtual_subclasses(True) False IOW, I think this

[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

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ran some benchmark numbers: $ ./python -m timeit -s from pprint import saferepr; s='é\x' * 1000 saferepr(s) - before patch: 555 usec per loop - after patch: 10.9 usec per loop $ ./python -m timeit -s from pprint import saferepr; s='xxx' * 1000 saferepr(s) -

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: It's called get_VIRTUAL_subclasses() for a reason. You can get the real subclasses of an ABC with standard tool, e.g. recurse into __subclasses__(). For virtual subclasses you have to deal with the internals like _abc_registry. I could implement all four

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

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: It's called get_VIRTUAL_subclasses() for a reason. You can get the real subclasses of an ABC with standard tool, e.g. recurse into __subclasses__(). What use case are you trying to solve? If I want to find out all classes which implement an ABC, I don't care

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can just remove if typ is str: case at all. A general case works for strings. But for performance (this will slowdown Antoine's tests by 15-20%) we should left it and may be even extend it to other builtin types: builtin_type = (str, int, float,

[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

[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 AF.IPv4: 1 -- '%s' % AF.IPv4 'AF.IPv4' -- '%r' % AF.IPv4 'AF.IPv4: 1' -- '%d' % AF.IPv4 'AF.IPv4' -- '%i' % AF.IPv4

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: `.format()` is surprised too. '{:}'.format(AF.IPv4) 'AF.IPv4' '{:10}'.format(AF.IPv4) ' 1' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18738

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

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18738 ___ ___ Python-bugs-list

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: In Objects/unicodeobject.c when it gets into mainformatlong, an IntEnum is recognized as an integer (passes PyLong_Check) and goes into formatlong. There, in the cases of 'd', 'i', 'u' it has: case 'u': /* Special-case boolean: we want 0/1 */

[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

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

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: I thing the AddressFamily enum class and the family property should be documented. I'm leaving the documentation to the end when we decide on the implementation strategy. Once that happens I'll post a patch with .rst changes, etc. --

[issue18606] Add statistics module to standard library

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

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

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I thing the AddressFamily enum class and the family property should be documented. -- ___ 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 Serhiy Storchaka
Serhiy Storchaka added the comment: Nitpick: If we have grouped this constants in an enum class perhaps it will be good if they will be enumerated in the order of its values. Or no? -- ___ Python tracker rep...@bugs.python.org

[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 rep...@bugs.python.org http://bugs.python.org/issue18738 ___

[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 rep...@bugs.python.org

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Ethan, str.format uses __format__. We don't seem to provide a custom one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18738 ___

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 6:55 AM, Serhiy Storchaka rep...@bugs.python.orgwrote: Serhiy Storchaka added the comment: `.format()` is surprised too. '{:}'.format(AF.IPv4) 'AF.IPv4' '{:10}'.format(AF.IPv4) ' 1' Oh, this looks like a bug in

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

2013-08-14 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- title: % formatting incomplete for Enum - String formatting (% and str.format) issues with Enum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18738

[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 rep...@bugs.python.org http://bugs.python.org/issue18738 ___ ___

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3b82e0d83bf9 by Richard Oudkerk in branch 'default': Issue #8713: Support alternative start methods in multiprocessing on Unix. http://hg.python.org/cpython/rev/3b82e0d83bf9 -- nosy: +python-dev ___

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Gregory P. Smith
New submission from Gregory P. Smith: This is a very odd inconsistency in math.log behavior. That said, it is probably only a single bit imprecision at the end of the float result. Still, 10 == 10L so I'd expect math.log of both to give the same result. oss/cpython/2.7:LOAS$ ./python Python

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: Fascinating, how did you find the issue? -- nosy: +christian.heimes, mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18739 ___

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

2013-08-14 Thread Brett Cannon
Brett Cannon added the comment: I think you mean in 3.3 and yes. =) Patch LGTM so I say fix in 3.3 and merge into default. -- assignee: - eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18698

  1   2   >