Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Devin Jeanpierre
On Fri, Oct 19, 2012 at 10:13 AM, Nick Coghlan wrote: > On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni wrote: >> Is that the real intended behavior? > > Given the way complex numbers interact with floats generally, > returning a complex number with no imaginary component as a floating > point val

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Greg Ewing
Stephen J. Turnbull wrote: It's a design bug, yes. The question is, does it conform to documented behavior? The 2.7 docs say this about __complex__: Called to implement the built-in function complex() ... Should return a value of the appropriate type. So the question is whether float i

Re: [Python-Dev] accept the wheel PEPs 425, 426, 427

2012-10-19 Thread Stephen J. Turnbull
Daniel Holth writes: > Tweaked at http://hg.python.org/peps/rev/75474fb879d3 I'll take a look later; I have some other commitments now I should do first. > On Thu, Oct 18, 2012 at 10:55 PM, Stephen J. Turnbull > wrote: > > Executive summary: > > > > You probably should include a full ABNF

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Stephen J. Turnbull
Maciej Fijalkowski writes: > Nick just said it's a bug that cmath type checks are too strict. It's a design bug, yes. The question is, does it conform to documented behavior? If so, it's not an implementation bug that should be fixed in 2.7. ___ Pyth

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Nick Coghlan
On Sat, Oct 20, 2012 at 2:23 AM, Maciej Fijalkowski wrote: > On Fri, Oct 19, 2012 at 5:56 PM, Benjamin Peterson > wrote: >> It's a new feature. Also, it's possible that someone is relying on it >> throwing for non-complex values. >> > > Nick just said it's a bug that cmath type checks are too st

Re: [Python-Dev] accept the wheel PEPs 425, 426, 427

2012-10-19 Thread Barry Warsaw
On Oct 19, 2012, at 08:07 PM, Daniel Holth wrote: >The email parser is significantly more permissive than the RFC. Don't forget that the email package now supports policies (experimentally), so it may be possible to tweak a policy setting to fit the bill. Anyway, it might at least be interesting

Re: [Python-Dev] accept the wheel PEPs 425, 426, 427

2012-10-19 Thread Daniel Holth
Tweaked at http://hg.python.org/peps/rev/75474fb879d3 On Thu, Oct 18, 2012 at 10:55 PM, Stephen J. Turnbull wrote: > Executive summary: > > You probably should include a full ABNF grammar The legacy PKG-INFO does not have email parse-ability. How about an example parser implementation instea

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Greg Ewing
Antonio Cuni wrote: Traceback (most recent call last): File "", line 1, in TypeError: __complex__ should return a complex object i.e., the complex constructor does not check that __complex__ returns an actual complex, while the cmath functions do. Looks to me like cmath is being excessively

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Georg Brandl
On 10/19/2012 06:44 PM, Tres Seaver wrote: > On 10/19/2012 11:56 AM, Benjamin Peterson wrote: >> 2012/10/19 Tres Seaver : >>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >>> >>> On 10/19/2012 11:26 AM, Benjamin Peterson wrote: 2012/10/19 Antonio Cuni : > indeed, you are right. So I suppo

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Brett Cannon
On Fri, Oct 19, 2012 at 12:48 PM, Benjamin Peterson wrote: > 2012/10/19 Tres Seaver : > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > On 10/19/2012 11:56 AM, Benjamin Peterson wrote: > >> 2012/10/19 Tres Seaver : > >>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > >>> > >>> On 10/1

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Benjamin Peterson
2012/10/19 Tres Seaver : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/19/2012 11:56 AM, Benjamin Peterson wrote: >> 2012/10/19 Tres Seaver : >>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >>> >>> On 10/19/2012 11:26 AM, Benjamin Peterson wrote: 2012/10/19 Antonio Cuni : >

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/19/2012 11:56 AM, Benjamin Peterson wrote: > 2012/10/19 Tres Seaver : >> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> >> On 10/19/2012 11:26 AM, Benjamin Peterson wrote: >>> 2012/10/19 Antonio Cuni : indeed, you are right. So I suppose

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Mark Dickinson
On Fri, Oct 19, 2012 at 5:31 PM, Christian Heimes wrote: > In order to fix the bug the code in PyComplex_AsCComplex() must be > altered to support float as return type from __complex__(). That's a > major change. Agreed that this doesn't seem appropriate for bugfix releases. We might also want t

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Christian Heimes
Am 19.10.2012 18:23, schrieb Maciej Fijalkowski: > Nick just said it's a bug that cmath type checks are too strict. I'm not so sure about that. cmath just uses PyArg_ParseTuple with "D" which itself relies upon PyComplex_AsCComplex(). D (complex) [Py_complex] Convert a Python complex number t

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Mark Dickinson
On Fri, Oct 19, 2012 at 4:26 PM, Benjamin Peterson wrote: > 2012/10/19 Antonio Cuni : >> indeed, you are right. So I suppose that in pypy we could just relax the >> check >> in cmath and be happy. Is there any chance that this will be changed in 2.7 >> and/or 3.x? > > Certainly 3.x, but not 2.7.

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Maciej Fijalkowski
On Fri, Oct 19, 2012 at 5:56 PM, Benjamin Peterson wrote: > 2012/10/19 Tres Seaver : >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 10/19/2012 11:26 AM, Benjamin Peterson wrote: >>> 2012/10/19 Antonio Cuni : indeed, you are right. So I suppose that in pypy we could just relax >>

[Python-Dev] Summary of Python tracker Issues

2012-10-19 Thread Python tracker
ACTIVITY SUMMARY (2012-10-12 - 2012-10-19) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open3815 (+26) closed 24249 (+48) total 28064 (+74) Open issues wit

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Benjamin Peterson
2012/10/19 Tres Seaver : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/19/2012 11:26 AM, Benjamin Peterson wrote: >> 2012/10/19 Antonio Cuni : >>> indeed, you are right. So I suppose that in pypy we could just relax >>> the check in cmath and be happy. Is there any chance that this wi

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/19/2012 11:26 AM, Benjamin Peterson wrote: > 2012/10/19 Antonio Cuni : >> indeed, you are right. So I suppose that in pypy we could just relax >> the check in cmath and be happy. Is there any chance that this will >> be changed in 2.7 and/or 3.x?

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Benjamin Peterson
2012/10/19 Antonio Cuni : > indeed, you are right. So I suppose that in pypy we could just relax the check > in cmath and be happy. Is there any chance that this will be changed in 2.7 > and/or 3.x? Certainly 3.x, but not 2.7. -- Regards, Benjamin __

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Antonio Cuni
On 10/19/2012 04:13 PM, Nick Coghlan wrote: > On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni wrote: >> Is that the real intended behavior? > > Given the way complex numbers interact with floats generally, > returning a complex number with no imaginary component as a floating > point value seems l

Re: [Python-Dev] PEP 426 comment: field order

2012-10-19 Thread Daniel Holth
On Fri, Oct 19, 2012 at 10:20 AM, Barry Warsaw wrote: > On Oct 18, 2012, at 09:23 PM, Daniel Holth wrote: > >>The email module provides an ordered multidict interface to the data. >>The first tag wins (if you improperly define Name: twice for example), >>but the order of everything is preserved. W

Re: [Python-Dev] Rejecting PEPs 407 and 413?

2012-10-19 Thread Nick Coghlan
On Sat, Oct 20, 2012 at 12:14 AM, Barry Warsaw wrote: > On Oct 19, 2012, at 09:33 PM, Nick Coghlan wrote: > >>At the moment, with the "3.4" used throughout the examples in both >>PEPs, it's a little confusing w.r.t the actual 3.4 release PEP. I >>could live with "Deferred" instead of "Rejected", b

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Maciej Fijalkowski
On Fri, Oct 19, 2012 at 4:13 PM, Nick Coghlan wrote: > On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni wrote: >> Is that the real intended behavior? > > Given the way complex numbers interact with floats generally, > returning a complex number with no imaginary component as a floating > point valu

Re: [Python-Dev] PEP 426 comment: field order

2012-10-19 Thread Barry Warsaw
On Oct 18, 2012, at 09:23 PM, Daniel Holth wrote: >The email module provides an ordered multidict interface to the data. >The first tag wins (if you improperly define Name: twice for example), >but the order of everything is preserved. We just don't need it, >except that it might be surprising to

Re: [Python-Dev] Rejecting PEPs 407 and 413?

2012-10-19 Thread Barry Warsaw
On Oct 19, 2012, at 09:33 PM, Nick Coghlan wrote: >At the moment, with the "3.4" used throughout the examples in both >PEPs, it's a little confusing w.r.t the actual 3.4 release PEP. I >could live with "Deferred" instead of "Rejected", but one or the other >should happen. I no longer have much in

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Nick Coghlan
On Fri, Oct 19, 2012 at 11:08 PM, Antonio Cuni wrote: > Is that the real intended behavior? Given the way complex numbers interact with floats generally, returning a complex number with no imaginary component as a floating point value seems legitimate and the checks in cmath overly strict. Otherw

Re: [Python-Dev] cpython (2.7): Issue #6074: Restore the long-broken support for running with read-only source

2012-10-19 Thread Nick Coghlan
On Fri, Oct 19, 2012 at 11:36 PM, Serhiy Storchaka wrote: > Why not just > > return (name + os.extsep + "py", > > name + os.extsep + "pyc", > name + os.extsep + "pyo", > name + os.extsep + "pyw", > name + "$py.class") No good reason - I copied t

[Python-Dev] return type of __complex__

2012-10-19 Thread Antonio Cuni
Hi, while fixing pypy to pass CPython 3.2 tests, I found what I think it's a inconsistency in how CPython (both 2.7 and 3.2) handles __complex__: >>> class Obj: ... def __complex__(self): ... return 2.0 ... >>> obj = Obj() >>> complex(obj) (2+0j) >>> >>> import cmath >>> cmath.acos(ob

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Brett Cannon
On Fri, Oct 19, 2012 at 8:36 AM, Victor Stinner wrote: > 2012/10/19 Benjamin Peterson : > > It would be interesting to see how common it is for strings which have > > their hash computed to be compared. > > I implemented a quick hack. When running "./python -m test test_os": > Python calls PyUnico

Re: [Python-Dev] cpython (2.7): Issue #6074: Restore the long-broken support for running with read-only source

2012-10-19 Thread Serhiy Storchaka
On 19.10.12 14:58, nick.coghlan wrote: http://hg.python.org/cpython/rev/321414874b26 changeset: 79827:321414874b26 branch: 2.7 parent: 79814:2f0770cc6d3f user:Nick Coghlan date:Fri Oct 19 21:58:18 2012 +1000 summary: Issue #6074: Restore the long-broken support for

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Oscar Benjamin
On 19 October 2012 11:02, Duncan Booth wrote: > Hrvoje Niksic wrote: > >> On 10/19/2012 03:22 AM, Benjamin Peterson wrote: >>> It would be interesting to see how common it is for strings which have >>> their hash computed to be compared. >> >> Since all identifier-like strings mentioned in Python

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Benjamin Peterson
2012/10/19 Duncan Booth : > Hrvoje Niksic wrote: > >> On 10/19/2012 03:22 AM, Benjamin Peterson wrote: >>> It would be interesting to see how common it is for strings which have >>> their hash computed to be compared. >> >> Since all identifier-like strings mentioned in Python are interned, and >>

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Victor Stinner
2012/10/19 Benjamin Peterson : > It would be interesting to see how common it is for strings which have > their hash computed to be compared. I implemented a quick hack. When running "./python -m test test_os": Python calls PyUnicode_RichCompare() 15206 times with Py_EQ or Py_NE operator. In 41.4%

Re: [Python-Dev] Rejecting PEPs 407 and 413?

2012-10-19 Thread Nick Coghlan
On Fri, Oct 19, 2012 at 9:01 PM, Larry Hastings wrote: > FWIW I don't think those peps should be rejected simply because I didn't > follow either for the 3.4 release schedule. I think they should both have > their day in the court of public opinion. (Of course, maybe that day has > already passe

Re: [Python-Dev] Rejecting PEPs 407 and 413?

2012-10-19 Thread Larry Hastings
On 10/18/2012 08:02 PM, Nick Coghlan wrote: With the 3.4 release PEP published using a traditional schedule, perhaps MvL would care to do the honours as BDFL-Delegate in rejecting the two "faster release cycle for the standard library" PEPs? (I know I asked to hold off on that when MvL last brou

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Duncan Booth
Hrvoje Niksic wrote: > On 10/19/2012 03:22 AM, Benjamin Peterson wrote: >> It would be interesting to see how common it is for strings which have >> their hash computed to be compared. > > Since all identifier-like strings mentioned in Python are interned, and > therefore have had their hash co

Re: [Python-Dev] Why not using the hash when comparing strings?

2012-10-19 Thread Hrvoje Niksic
On 10/19/2012 03:22 AM, Benjamin Peterson wrote: It would be interesting to see how common it is for strings which have their hash computed to be compared. Since all identifier-like strings mentioned in Python are interned, and therefore have had their hash computed, I would imagine comparing