Re: [Python-Dev] PEP 362 Third Revision

2012-06-13 Thread Alexandre Zani
On Wed, Jun 13, 2012 at 8:06 PM, Yury Selivanov wrote: > On 2012-06-13, at 10:52 PM, Yury Selivanov wrote: >> 2. signature() function support all kinds of callables: >> classes, metaclasses, methods, class- & staticmethods, >> 'functools.partials', and callable objects.  If a callable >> object ha

Re: [Python-Dev] PEP 362 Third Revision

2012-06-13 Thread Nick Coghlan
On Thu, Jun 14, 2012 at 1:06 PM, Yury Selivanov wrote: > On 2012-06-13, at 10:52 PM, Yury Selivanov wrote: >> 2. signature() function support all kinds of callables: >> classes, metaclasses, methods, class- & staticmethods, >> 'functools.partials', and callable objects.  If a callable >> object ha

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, Jun 13, 2012 at 03:13:54PM -0400, R. David Murray wrote: Again, a program that depends on asserts is buggy. As Ethan pointed out we are asking about the case where someone is *deliberately* setting the .pyo file up to be run as the "normal" case. You can't be s

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Steven D'Aprano
On Wed, Jun 13, 2012 at 09:54:30PM -0400, Terry Reedy wrote: > >So, no, we > > You mean the interpreter? Yes. > >should never use > > Do you mean import or execute? > Current, the interpreter executes any bytecode that gets imported. Both. > >.pyo files unless explicitly told to do so, > >

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Steven D'Aprano
On Wed, Jun 13, 2012 at 04:06:22PM -0400, Terry Reedy wrote: > On 6/13/2012 2:46 PM, Antoine Pitrou wrote: > > >Not only docstrings, but also asserts. I think running a pyo without -O > >would be a bug. > > That cat is already out of the bag ;-) > People are doing that now by renaming x.pyo to x.

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Steven D'Aprano
On Wed, Jun 13, 2012 at 03:13:54PM -0400, R. David Murray wrote: > Again, a program that depends on asserts is buggy. > > As Ethan pointed out we are asking about the case where someone is > *deliberately* setting the .pyo file up to be run as the "normal" > case. You can't be sure that the .pyo

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Terry Reedy
On 6/13/2012 10:47 PM, R. David Murray wrote: On Thu, 14 Jun 2012 11:48:08 +1000, Nick Coghlan wrote: Right, but by resorting to either of those approaches, people are clearly doing something that isn't formally supported by the core. That was not clear to me until I read your post -- the k

Re: [Python-Dev] PEP 362 Third Revision

2012-06-13 Thread Yury Selivanov
On 2012-06-13, at 10:52 PM, Yury Selivanov wrote: > 2. signature() function support all kinds of callables: > classes, metaclasses, methods, class- & staticmethods, > 'functools.partials', and callable objects. If a callable > object has a '__signature__' attribute it does a deepcopy > of it befor

[Python-Dev] PEP 362 Third Revision

2012-06-13 Thread Yury Selivanov
Hello, The new revision of PEP 362 has been posted: http://www.python.org/dev/peps/pep-0362/ Summary: 1. Signature object now represents the call signature of a function. That said, it doesn't have 'name' and 'qualname' attributes anymore, and can be tested for equality against other signature

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread R. David Murray
On Thu, 14 Jun 2012 11:48:08 +1000, Nick Coghlan wrote: > On Thu, Jun 14, 2012 at 6:06 AM, Terry Reedy wrote: > > On 6/13/2012 2:46 PM, Antoine Pitrou wrote: > > > >> Not only docstrings, but also asserts. I think running a pyo without -O > >> would be a bug. > > > > That cat is already out of th

Re: [Python-Dev] Tunable parameters in dictobject.c (was dictnotes.txt out of date?)

2012-06-13 Thread Terry Reedy
On 6/13/2012 9:15 PM, Raymond Hettinger wrote: On Jun 13, 2012, at 2:37 PM, Mark Shannon wrote: I think that for combined tables a growth factor of x2 is best, but I don't have any hard evidence to back that up. I believe that change should be reverted. You've undone work that was based on e

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Terry Reedy
On 6/13/2012 8:55 PM, Steven D'Aprano wrote: On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: So, is there any reason to not use the .pyo file (if that's all that is around) when -O is not specified? .pyo and .pyc files have potentially different semantics. Right now, .pyo fil

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Nick Coghlan
On Thu, Jun 14, 2012 at 6:06 AM, Terry Reedy wrote: > On 6/13/2012 2:46 PM, Antoine Pitrou wrote: > >> Not only docstrings, but also asserts. I think running a pyo without -O >> would be a bug. > > > That cat is already out of the bag ;-) > People are doing that now by renaming x.pyo to x.pyc. > B

Re: [Python-Dev] backporting stdlib 2.7.x from pypy to cpython

2012-06-13 Thread Brian Curtin
On Jun 13, 2012 8:31 PM, "Stephen J. Turnbull" wrote: > > Cameron Simpson writes: > > > This approach has its own problems. Is the proposed list, like many lists, > > restricted to accept posts only from subscribers? If that is the case, > > when someone CCs the VM list, everyone honouring the

Re: [Python-Dev] backporting stdlib 2.7.x from pypy to cpython

2012-06-13 Thread Stephen J. Turnbull
Cameron Simpson writes: > This approach has its own problems. Is the proposed list, like many lists, > restricted to accept posts only from subscribers? If that is the case, > when someone CCs the VM list, everyone honouring the CC in replies needs > to be a VM list member if they are not to g

Re: [Python-Dev] Tunable parameters in dictobject.c (was dictnotes.txt out of date?)

2012-06-13 Thread Raymond Hettinger
On Jun 13, 2012, at 2:37 PM, Mark Shannon wrote: > I think that for combined tables a growth factor of x2 is best, > but I don't have any hard evidence to back that up. I believe that change should be reverted. You've undone work that was based on extensive testing and timings of many python

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Steven D'Aprano
On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: > So, is there any reason to not use the .pyo file (if that's all that is > around) when -O is not specified? .pyo and .pyc files have potentially different semantics. Right now, .pyo files don't include asserts, so that's one diff

Re: [Python-Dev] TZ-aware local time

2012-06-13 Thread Alexander Belopolsky
On Tue, Jun 12, 2012 at 1:14 AM, Ben Finney wrote: >> To the contrary, without the POSIX timestamp model to define the >> equivalency between the same point in time expressed using different >> timezones, sane comparisons and arithmetic on timestamps would be >> impossible. > > Why is the POSIX ti

Re: [Python-Dev] backporting stdlib 2.7.x from pypy to cpython

2012-06-13 Thread Cameron Simpson
On 11Jun2012 15:35, PJ Eby wrote: | Yes, perhaps if the list were *just* a place to cc: in or send a heads-up | to python-dev discussions, and not to have actual list discussions per se, | that would do the trick. This approach has its own problems. Is the proposed list, like many lists, restrict

[Python-Dev] Tunable parameters in dictobject.c (was dictnotes.txt out of date?)

2012-06-13 Thread Mark Shannon
Raymond Hettinger wrote: On Jun 13, 2012, at 10:35 AM, Eli Bendersky wrote: Did you mean to send this to the list, Raymond? Yes. I wanted to find-out whether someone approved changing all the dict tunable parameters. I thought those weren't supposed to have changed. PEP 412 notes that t

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Terry Reedy
On 6/13/2012 1:19 PM, Brett Cannon wrote: On Tue, Jun 12, 2012 at 2:16 PM, Terry Reedy mailto:tjre...@udel.edu>> wrote: http://bugs.python.org/__issue12982 Currently, cpython requires the -O flag to *read* .pyo files as well as the write them. Th

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Terry Reedy
On 6/13/2012 2:46 PM, Antoine Pitrou wrote: Not only docstrings, but also asserts. I think running a pyo without -O would be a bug. That cat is already out of the bag ;-) People are doing that now by renaming x.pyo to x.pyc. Brett claims that it is also easy to do in 3.3 with a custom importer

Re: [Python-Dev] dictnotes.txt out of date?

2012-06-13 Thread Raymond Hettinger
On Jun 13, 2012, at 10:35 AM, Eli Bendersky wrote: > Did you mean to send this to the list, Raymond? Yes. I wanted to find-out whether someone approved changing all the dict tunable parameters. I thought those weren't supposed to have changed. PEP 412 notes that the existing parameters were

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Ethan Furman
R. David Murray wrote: On Wed, 13 Jun 2012 20:46:50 +0200, Antoine Pitrou wrote: On Wed, 13 Jun 2012 11:20:24 -0700 Toshio Kuratomi wrote: On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: OK, but you didn't answer the question :). If I understand correctly, everything you sa

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread R. David Murray
On Wed, 13 Jun 2012 20:46:50 +0200, Antoine Pitrou wrote: > On Wed, 13 Jun 2012 11:20:24 -0700 > Toshio Kuratomi wrote: > > On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: > > > > > > OK, but you didn't answer the question :). If I understand correctly, > > > everything you sai

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread R. David Murray
On Wed, 13 Jun 2012 11:20:24 -0700, Toshio Kuratomi wrote: > On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: > > > > OK, but you didn't answer the question :). If I understand correctly, > > everything you said applies to *writing* the bytecode, not reading it. > > > > So, is t

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Ethan Furman
Toshio Kuratomi wrote: On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: OK, but you didn't answer the question :). If I understand correctly, everything you said applies to *writing* the bytecode, not reading it. So, is there any reason to not use the .pyo file (if that's all t

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Antoine Pitrou
On Wed, 13 Jun 2012 11:20:24 -0700 Toshio Kuratomi wrote: > On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: > > > > OK, but you didn't answer the question :). If I understand correctly, > > everything you said applies to *writing* the bytecode, not reading it. > > > > So, is th

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Ethan Furman
Brett Cannon wrote: On Tue, Jun 12, 2012 at 2:16 PM, Terry Reedy wrote: http://bugs.python.org/__issue12982 Currently, cpython requires the -O flag to *read* .pyo files as well as the write them. This is a nuisance to people who receive them from others, wit

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Toshio Kuratomi
On Wed, Jun 13, 2012 at 01:58:10PM -0400, R. David Murray wrote: > > OK, but you didn't answer the question :). If I understand correctly, > everything you said applies to *writing* the bytecode, not reading it. > > So, is there any reason to not use the .pyo file (if that's all that is > around

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread R. David Murray
On Wed, 13 Jun 2012 13:19:43 -0400, Brett Cannon wrote: > On Tue, Jun 12, 2012 at 2:16 PM, Terry Reedy wrote: > > > http://bugs.python.org/**issue12982 > > > > Currently, cpython requires the -O flag to *read* .pyo files as well as > > the write them. This is

Re: [Python-Dev] #12982: Should -O be required to *read* .pyo files?

2012-06-13 Thread Brett Cannon
On Tue, Jun 12, 2012 at 2:16 PM, Terry Reedy wrote: > http://bugs.python.org/**issue12982 > > Currently, cpython requires the -O flag to *read* .pyo files as well as > the write them. This is a nuisance to people who receive them from others, > without the sour

Re: [Python-Dev] [compatibility-sig] making sure importlib.machinery.SourceLoader doesn't throw an exception if bytecode is not supported by a VM

2012-06-13 Thread Brett Cannon
On Wed, Jun 13, 2012 at 1:18 AM, Nick Coghlan wrote: > On Wed, Jun 13, 2012 at 11:10 AM, Brett Cannon wrote: > >> > This does mean, though, that imp.cache_from_source() and > >> > imp.source_from_cache() might need to be updated to raise a reasonable > >> > exception when sys.implementation.cach

Re: [Python-Dev] what is happening with the regex module going into Python 3.3?

2012-06-13 Thread Georg Brandl
Am 04.06.2012 00:51, schrieb "Martin v. Löwis": >> That last statement basically suggests that something like regex would >> never be accepted until a CPython core developer was actually running >> into pain with the many flaws in the re module (especially when it comes >> to Unicode). I disagree

Re: [Python-Dev] dictnotes.txt out of date?

2012-06-13 Thread Eli Bendersky
>> I was looking at the memory allocation strategy of dict, out of >> curiosity, and noted that Objects/dictnotes.txt is out of date as far >> as the parameters go. It says about PyDict_STARTSIZE: >> >> >> * PyDict_STARTSIZE. Starting size of dict (unless an instance dict). >>    Currently set

Re: [Python-Dev] dictnotes.txt out of date?

2012-06-13 Thread Mark Shannon
Eli Bendersky wrote: Hi pydev, I was looking at the memory allocation strategy of dict, out of curiosity, and noted that Objects/dictnotes.txt is out of date as far as the parameters go. It says about PyDict_STARTSIZE: * PyDict_STARTSIZE. Starting size of dict (unless an instance dict).

Re: [Python-Dev] issue #15038 - Optimize python Locks on Windows

2012-06-13 Thread Antoine Pitrou
On Wed, 13 Jun 2012 13:47:28 + Kristján Valur Jónsson wrote: > I have reworked the patch, so it might be helpful to specify what exactly it > is that you object to. Perhaps in the defect itself. > I can add here that your worries that the previous patch defaulted to Vista > specific feature

Re: [Python-Dev] issue #15038 - Optimize python Locks on Windows

2012-06-13 Thread Kristján Valur Jónsson
I have reworked the patch, so it might be helpful to specify what exactly it is that you object to. Perhaps in the defect itself. I can add here that your worries that the previous patch defaulted to Vista specific features, were actually unfounded. I've added my reasons for including vista spec

[Python-Dev] dictnotes.txt out of date?

2012-06-13 Thread Eli Bendersky
Hi pydev, I was looking at the memory allocation strategy of dict, out of curiosity, and noted that Objects/dictnotes.txt is out of date as far as the parameters go. It says about PyDict_STARTSIZE: * PyDict_STARTSIZE. Starting size of dict (unless an instance dict). Currently set to 8. M