Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Guido van Rossum
On Tue, Dec 11, 2012 at 5:11 PM, Robert Brewer wrote: > Guido van Rossum wrote: >> Sent: Tuesday, December 11, 2012 4:11 PM >> To: Antoine Pitrou >> Cc: python-dev@python.org >> Subject: Re: [Python-Dev] Draft PEP for time zone support. >> >> On Tue, Dec 11, 2012 at 8:07 AM, Antoine Pitrou >> wro

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Guido van Rossum
On Tue, Dec 11, 2012 at 7:19 PM, Barry Warsaw wrote: > On Dec 12, 2012, at 01:14 PM, Nick Coghlan wrote: > >>That's a backwards compatibility risk, though - many applications are >>likely coping just fine with the slightly corrupted time values, but would >>fall over if an exception was raised ins

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 12, 2012, at 01:14 PM, Nick Coghlan wrote: >That's a backwards compatibility risk, though - many applications are >likely coping just fine with the slightly corrupted time values, but would >fall over if an exception was raised instead. The default should probably >be chosen so that the sin

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Nick Coghlan
On Wed, Dec 12, 2012 at 12:58 PM, Barry Warsaw wrote: > On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: > > >A new ``is_dst`` parameter is added to several of the `tzinfo` methods to > >handle time ambiguity during DST changeovers. > > >``None`` will raise an ``AmbiguousTimeError`` exception

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: >A new ``is_dst`` parameter is added to several of the `tzinfo` methods to >handle time ambiguity during DST changeovers. >``None`` will raise an ``AmbiguousTimeError`` exception if the time specified >was during a DST change over. It will also

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 11, 2012, at 03:31 PM, Barry Warsaw wrote: >I've assigned this PEP 431, reformatted a few extra wide paragraphs, committed >and pushed. Unfortunately, it looks like the online PEP updater isn't working. -Barry signature.asc Description: PGP signature

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 11, 2012, at 03:37 PM, Brandon W Maister wrote: >Barry you want github raw: >https://raw.github.com/regebro/tz-pep/master/pep-04tz.txt I found that out. I was mostly just complaining. ;) -Barry signature.asc Description: PGP signature ___ Pyt

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 11, 2012, at 03:48 PM, Paul Moore wrote: >I agree. Also, in corporate or similar environments where each >individual package installation must be approved, having at least some >timezone data in the base install ensures that all Python code can >assume the *existence* of timezone support (i

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
Great work, Lennart. I really like this PEP. Feedback follows (I haven't yet read the rest of the messages in this thread ;). On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: >This PEP proposes to add these ``is_dst`` parameters to the relevant methods >of the ``datetime`` API, and therefor

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Robert Brewer
Guido van Rossum wrote: > Sent: Tuesday, December 11, 2012 4:11 PM > To: Antoine Pitrou > Cc: python-dev@python.org > Subject: Re: [Python-Dev] Draft PEP for time zone support. > > On Tue, Dec 11, 2012 at 8:07 AM, Antoine Pitrou > wrote: > > Le Tue, 11 Dec 2012 16:23:37 +0100, > > Lennart Regebro

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Nick Coghlan
On Wed, Dec 12, 2012 at 1:23 AM, Lennart Regebro wrote: > Abstract > > > This PEP proposes the implementation of concrete time zone support in the > Python standard library, and also improvements to the time zone API to deal > with ambiguous time specifications during DST changes. > Tha

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Nick Coghlan
On Wed, Dec 12, 2012 at 5:37 AM, Dino Viehland wrote: > OTOH changing certain dictionaries in IronPython (such as keyword args) to > be > ordered would certainly be possible. Personally I just wouldn't want to > see it > be the default as that seems like unnecessary overhead when the specialized

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Guido van Rossum
On Tue, Dec 11, 2012 at 8:07 AM, Antoine Pitrou wrote: > Le Tue, 11 Dec 2012 16:23:37 +0100, > Lennart Regebro a écrit : >> >> Changes in the ``datetime``-module >> -- >> >> A new ``is_dst`` parameter is added to several of the `tzinfo` >> methods to handle tim

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Brandon W Maister
Barry you want github raw: https://raw.github.com/regebro/tz-pep/master/pep-04tz.txt On Tue, Dec 11, 2012 at 3:31 PM, Barry Warsaw wrote: > On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: > > >This PEP is also available on github: > > > >https://github.com/regebro/tz-pep/blob/master/pep-04

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Donald Stufft
On Tuesday, December 11, 2012 at 3:31 PM, Barry Warsaw wrote: > On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: > > > This PEP is also available on github: > > > > https://github.com/regebro/tz-pep/blob/master/pep-04tz.txt > > wget returns some html gobbledygook. Why-oh-why github?!' wget h

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Barry Warsaw
On Dec 11, 2012, at 04:23 PM, Lennart Regebro wrote: >This PEP is also available on github: > >https://github.com/regebro/tz-pep/blob/master/pep-04tz.txt wget returns some html gobbledygook. Why-oh-why github?! >PEP: 4?? I've assigned this PEP 431, reformatted a few extra wide paragraphs, comm

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Dino Viehland
PJ wrote: > Actually, IronPython may already have ordered dictionaries by default; see: > > http://mail.python.org/pipermail/ironpython-users/2006- > May/002319.html > > It's described as an implementation detail that may change, perhaps that > could be changed to being unchanging. ;-) > I t

Re: [Python-Dev] Do more at compile time; less at runtime

2012-12-11 Thread Guido van Rossum
+1 On Dec 11, 2012 8:47 AM, "Ned Batchelder" wrote: > On 12/9/2012 5:22 PM, Mark Shannon wrote: > >> The current CPython bytecode interpreter is rather more complex than it >> needs to be. A number of bytecodes could be eliminated and a few more >> simplified by moving the work involved in handli

Re: [Python-Dev] Do more at compile time; less at runtime

2012-12-11 Thread Ned Batchelder
On 12/9/2012 5:22 PM, Mark Shannon wrote: The current CPython bytecode interpreter is rather more complex than it needs to be. A number of bytecodes could be eliminated and a few more simplified by moving the work involved in handling compound statements (loops, try-blocks, etc) from the interp

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Antoine Pitrou
Le Tue, 11 Dec 2012 16:23:37 +0100, Lennart Regebro a écrit : > > Changes in the ``datetime``-module > -- > > A new ``is_dst`` parameter is added to several of the `tzinfo` > methods to handle time ambiguity during DST changeovers. > > * ``tzinfo.utcoffset(se

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Brian Curtin
On Tue, Dec 11, 2012 at 9:48 AM, Paul Moore wrote: > On 11 December 2012 15:39, Dirkjan Ochtman wrote: >>> Should the windows installer include the data package? >>> -- >>> >>> It has been suggested that the Windows installer should include the

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Paul Moore
On 11 December 2012 15:39, Dirkjan Ochtman wrote: >> Should the windows installer include the data package? >> -- >> >> It has been suggested that the Windows installer should include the data >> package. This would mean that an explicit installa

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Dirkjan Ochtman
On Tue, Dec 11, 2012 at 4:23 PM, Lennart Regebro wrote: > Proposal > > > The time zone support will be implemented by a new module called `timezone``, > based on Stuart Bishop's ``pytz`` module. I wonder if there needs to be something here about how to port from pytz to the new timezone

[Python-Dev] Draft PEP for time zone support.

2012-12-11 Thread Lennart Regebro
This PEP is also available on github: https://github.com/regebro/tz-pep/blob/master/pep-04tz.txt Text: PEP: 4?? Title: Time zone support improvements Version: $Revision$ Last-Modified: $Date$ Author: Lennart Regebro BDFL-Delegate: Barry Warsaw Status: Draft Type: Standards Track Content-Type: t

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Serhiy Storchaka
Yet some comments about your Python implementation. 1. Don't use "is FREE" and "is DUMMY" as array doesn't preserve identity. 2. Wrong limits used in _make_index(): 128 overflows 'b', 65536 overflows 'h' and 'l' can be not enough for ssize_t. 3. round_upto_powtwo() can be implemented as 1 <<

[Python-Dev] 回复: where is the python "import" implemented

2012-12-11 Thread Isml
According to your advice, Now I can see my modified log. It's great! Thanks to Antoine and Martin!   Hello,Le Tue, 11 Dec 2012 14:08:27 +0800,"Isml" <76069...@qq.com> a écrit :> Hi, everyone,> I am testing modifying the pyc file when it is imported. As I> know, there is three situation:

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Antoine Pitrou
Le Tue, 11 Dec 2012 08:41:32 +, Mark Shannon a écrit : > > > > If you have a suggested allocation pattern or other > > constructive suggestion, it would be would welcome. > It seems like a reasonable starting point. > Trying to avoid resizing the index array and the entries array at the > sam

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Antoine Pitrou
Le Mon, 10 Dec 2012 18:17:57 -0500, Raymond Hettinger a écrit : > > On Dec 10, 2012, at 2:48 AM, Christian Heimes > wrote: > > > On the other hand every lookup and collision checks needs an > > additional multiplication, addition and pointer dereferencing: > > > > entry = entries_baseaddr + s

Re: [Python-Dev] where is the python "import" implemented

2012-12-11 Thread Antoine Pitrou
Hello, Le Tue, 11 Dec 2012 14:08:27 +0800, "Isml" <76069...@qq.com> a écrit : > Hi, everyone, > I am testing modifying the pyc file when it is imported. As I > know, there is three situation: 1、runing in the python.exe > eg: python.exe test.pyc > in this situation, I find the

Re: [Python-Dev] where is the python "import" implemented

2012-12-11 Thread martin
    in this situation, I can not find the source code how python implement it. I test a wrong format pyc, and got a error "ImportError: bad magic number",and I search "bad magic number" in the source code,  I find it is in importlib/_bootstrap.py(line 815),but when I modify this error info(eg:

Re: [Python-Dev] More compact dictionaries with faster iteration

2012-12-11 Thread Mark Shannon
On 11/12/12 03:45, Raymond Hettinger wrote: On Dec 10, 2012, at 7:04 PM, Mark Shannon mailto:m...@hotpy.org>> wrote: Another approach is to pre-allocate the two-thirds maximum (This is simple and fast but gives the smallest space savings.) What do you mean by maximum? A dict with an index