Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Nick Coghlan
On Sun, Apr 29, 2012 at 1:41 PM, PJ Eby wrote: > That's already the case.  Actually, sys.path[0] is *always* the absolute > path of the script directory -- regardless of whether you invoked the script > by a relative path or an absolute one, and regardless of whether you're > importing 'site' -- a

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread PJ Eby
On Sat, Apr 28, 2012 at 12:16 PM, R. David Murray wrote: > That said, could this insertion of '' only happen when the interactive > prompt is actually posted, and otherwise use cwd? > That's already the case. Actually, sys.path[0] is *always* the absolute path of the script directory -- regardle

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Steven D'Aprano
Brett Cannon wrote: On Sat, Apr 28, 2012 at 04:08, Nick Coghlan wrote: On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: I'm personally in favour of changing the insertion of '' to sys.path to inserting the cwd when the interpreter is launched. I'm not, because it breaks importing from t

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Terry Reedy
On 4/28/2012 3:16 PM, Brett Cannon wrote: Who does that? I mean what possible need do you have to start the interpreter in one directory, but then need to chdir somewhere else where you are doing your actual importing from, and in a way where you can't simply attach the directory you want to use

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Victor Stinner
Hi Guido, 2012/4/28 Guido van Rossum : > I read most of the PEP and I think it is ready for acceptance! Thanks > for your patience in shepherding this through such a difficult and > long discussion. You're welcome, but many developers helped me! > Also thanks to the many other contributors, > es

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Victor Stinner
>>> 2) get_clock_info returns a dict. Why not a namedtuple? >> >> Future flexibility. And there's no need for it to be a *tuple*. > > I haven't been paying attention to this discussion, so this isn't a > comment on any time functions specifically. > > But we generally use a namedtuple (or structseq

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Eric V. Smith
On 4/27/2012 11:40 PM, Guido van Rossum wrote: > On Fri, Apr 27, 2012 at 5:50 PM, Steven D'Aprano wrote: >> 2) get_clock_info returns a dict. Why not a namedtuple? > > Future flexibility. And there's no need for it to be a *tuple*. I haven't been paying attention to this discussion, so this isn'

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Victor Stinner
>> As a thin wrapper, adding it to the time module was pretty much >> uncontroversial, I think. The PEP proposes cross-platform >> functions with consistent semantics, which is where a discussion was >> needed. > > True, but does this mean clock_gettime and friends only exist on > POSIX? Shouldn't

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 12:16, R. David Murray wrote: > On Sat, 28 Apr 2012 18:08:08 +1000, Nick Coghlan > wrote: > > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > > I'm personally in favour of changing the insertion of '' to sys.path to > > > inserting the cwd when the interpreter is

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 09:35, Benjamin Peterson wrote: > 2012/4/28 Nick Coghlan : > > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > >> I'm personally in favour of changing the insertion of '' to sys.path to > >> inserting the cwd when the interpreter is launched. > > > > I'm not, becaus

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 04:08, Nick Coghlan wrote: > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > I'm personally in favour of changing the insertion of '' to sys.path to > > inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the interact

Re: [Python-Dev] questions about memory management

2012-04-28 Thread Antoine Pitrou
Hello Julia, On Sat, 28 Apr 2012 10:06:52 +0200 (CEST) Julia Lawall wrote: > In Python-3.2.3/Python/import.c, in the function > _PyImport_FixupExtensionUnicode, is any call to PyDict_DelItemString > needed before the final failure returns? I would say it probably does, but it would need furth

[Python-Dev] questions about memory management

2012-04-28 Thread Julia Lawall
In Python-3.2.3/Python/import.c, in the function _PyImport_FixupExtensionUnicode, is any call to PyDict_DelItemString needed before the final failure returns? modules = PyImport_GetModuleDict(); if (PyDict_SetItemString(modules, name, mod) < 0) return -1; if (_PyState_AddMod

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread R. David Murray
On Sat, 28 Apr 2012 18:08:08 +1000, Nick Coghlan wrote: > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > I'm personally in favour of changing the insertion of '' to sys.path to > > inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the int

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Guido van Rossum
On Sat, Apr 28, 2012 at 7:51 AM, Antoine Pitrou wrote: > On Sat, 28 Apr 2012 07:02:13 -0700 > Guido van Rossum wrote: >> > >> > It is this function: >> > http://docs.python.org/dev/library/time.html#time.clock_gettime >> > >> > It's just a binding of the C function clock_gettime(). Should the PEP

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Antoine Pitrou
On Sat, 28 Apr 2012 07:02:13 -0700 Guido van Rossum wrote: > > > > It is this function: > > http://docs.python.org/dev/library/time.html#time.clock_gettime > > > > It's just a binding of the C function clock_gettime(). Should the PEP > > describe all functions used by the PEP? > > Oh, now I'm con

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Guido van Rossum
On Sat, Apr 28, 2012 at 12:40 AM, Victor Stinner wrote: >> Surely those are all very minor quibbles. I have one myself: at some >> point it says: >> >>    On Linux, it is possible to use >> time.clock_gettime(CLOCK_THREAD_CPUTIME_ID). >> >> But the PEP doesn't define a function by that name. Is i

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Benjamin Peterson
2012/4/28 Nick Coghlan : > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: >> I'm personally in favour of changing the insertion of '' to sys.path to >> inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the interactive prompt if > you change dir

Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-28 Thread Sandro Tosi
On Wed, Apr 25, 2012 at 20:40, Georg Brandl wrote: > BTW, the single backticks don't do anything usable; use *pytz* to make > something > emphasized. yep, done. On Thu, Apr 26, 2012 at 03:06, Nick Coghlan wrote: > On Thu, Apr 26, 2012 at 4:40 AM, Georg Brandl wrote: >> Maybe it's useful to me

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Victor Stinner
> 3) The dict returned by get_clock_info includes an optional key, > "is_adjusted". Why is it optional? More complete answer. Rules used to fill the is_adjusted flag: - System clock: is_adjusted=1 because the clock can be set manually by the system administrator, except on Windows: is_adjusted

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Nick Coghlan
On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > I'm personally in favour of changing the insertion of '' to sys.path to > inserting the cwd when the interpreter is launched. I'm not, because it breaks importing from the interactive prompt if you change directory after starting the session.

Re: [Python-Dev] sys.implementation

2012-04-28 Thread Nick Coghlan
On Sat, Apr 28, 2012 at 6:11 AM, Glenn Linderman wrote: > Here's a ponderable: In the long term, should the documentation be unified > for multiple implementations?  Or should it be split into 4 pieces, so that > alternate implementations could swap in their own sections for > implementation depen

Re: [Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions

2012-04-28 Thread Victor Stinner
> Surely those are all very minor quibbles. I have one myself: at some > point it says: > >    On Linux, it is possible to use > time.clock_gettime(CLOCK_THREAD_CPUTIME_ID). > > But the PEP doesn't define a function by that name. Is it an editing > glitch? (Some of the pseudo code also uses this.)