Re: [Python-Dev] [Python-checkins] peps: Add Alexandre's suggestions

2011-08-16 Thread Antoine Pitrou
On Tue, 16 Aug 2011 12:35:48 +1000
Nick Coghlan  wrote:
> On Tue, Aug 16, 2011 at 11:30 AM, antoine.pitrou
>  wrote:
> > +Serializing "pseudo-global" objects
> > +---
> > +
> > +Objects which are not module-global, but should be treated in a similar
> > +fashion -- such as methods [4]_ or nested classes -- cannot currently be
> > +pickled (or, rather, unpickled) because the pickle protocol does not
> > +correctly specify how to retrieve them.  One solution would be through the
> > +adjunction of a ``__namespace__`` (or ``__qualname__``) to all class and
> > +function objects, specifying the full "path" by which they can be 
> > retrieved.
> > +For globals, this would generally be ``"{}.{}".format(obj.__module__, 
> > obj.__name__)``.
> > +Then a new opcode can resolve that path and push the object on the stack,
> > +similarly to the GLOBAL opcode.
> > +
> 
> I think this is the part that ties in with the pickle-related aspects
> for PEP 395 - using '__qualname__'  would be one way to align a
> module's real name with where it should be retrieved from and where
> it's documentation lives (I like 'qualified name' as a term, too).

Oops, I admit I hadn't read PEP 395.
PEP 395 focuses on module aliasing, while the suggestion above focuses
on the path of objects in modules. How can we reconcile the two? Do we
want __qualname__ to be a relative "path" inside the module?
(but then __qualname__ cannot specify its own module name).

Regards

Antoine.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] peps: Add Alexandre's suggestions

2011-08-16 Thread Nick Coghlan
On Tue, Aug 16, 2011 at 7:25 PM, Antoine Pitrou  wrote:
> On Tue, 16 Aug 2011 12:35:48 +1000
> Nick Coghlan  wrote:
>> On Tue, Aug 16, 2011 at 11:30 AM, antoine.pitrou
>>  wrote:
>> > +Serializing "pseudo-global" objects
>> > +---
>> > +
>> > +Objects which are not module-global, but should be treated in a similar
>> > +fashion -- such as methods [4]_ or nested classes -- cannot currently be
>> > +pickled (or, rather, unpickled) because the pickle protocol does not
>> > +correctly specify how to retrieve them.  One solution would be through the
>> > +adjunction of a ``__namespace__`` (or ``__qualname__``) to all class and
>> > +function objects, specifying the full "path" by which they can be 
>> > retrieved.
>> > +For globals, this would generally be ``"{}.{}".format(obj.__module__, 
>> > obj.__name__)``.
>> > +Then a new opcode can resolve that path and push the object on the stack,
>> > +similarly to the GLOBAL opcode.
>> > +
>>
>> I think this is the part that ties in with the pickle-related aspects
>> for PEP 395 - using '__qualname__'  would be one way to align a
>> module's real name with where it should be retrieved from and where
>> it's documentation lives (I like 'qualified name' as a term, too).
>
> Oops, I admit I hadn't read PEP 395.
> PEP 395 focuses on module aliasing, while the suggestion above focuses
> on the path of objects in modules. How can we reconcile the two? Do we
> want __qualname__ to be a relative "path" inside the module?
> (but then __qualname__ cannot specify its own module name).

I was more thinking that if pickle grew the ability to handle two
different names for objects, then PEP 395 could run off the same
feature without having to mess with sys.modules.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] peps: Add Alexandre's suggestions

2011-08-16 Thread Antoine Pitrou
On Tue, 16 Aug 2011 20:15:51 +1000
Nick Coghlan  wrote:
> >
> > Oops, I admit I hadn't read PEP 395.
> > PEP 395 focuses on module aliasing, while the suggestion above focuses
> > on the path of objects in modules. How can we reconcile the two? Do we
> > want __qualname__ to be a relative "path" inside the module?
> > (but then __qualname__ cannot specify its own module name).
> 
> I was more thinking that if pickle grew the ability to handle two
> different names for objects, then PEP 395 could run off the same
> feature without having to mess with sys.modules.

But what happens if a module contains, say, a nested class with a
__qualname__ (assigned by the interpreter) of "module_name.A.B", and the
module later gets a __qualname__ (assigned by the user) of
"module_alias"?

Regards

Antoine.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] peps: Add Alexandre's suggestions

2011-08-16 Thread Nick Coghlan
On Tue, Aug 16, 2011 at 9:23 PM, Antoine Pitrou  wrote:
> On Tue, 16 Aug 2011 20:15:51 +1000
> Nick Coghlan  wrote:
>> >
>> > Oops, I admit I hadn't read PEP 395.
>> > PEP 395 focuses on module aliasing, while the suggestion above focuses
>> > on the path of objects in modules. How can we reconcile the two? Do we
>> > want __qualname__ to be a relative "path" inside the module?
>> > (but then __qualname__ cannot specify its own module name).
>>
>> I was more thinking that if pickle grew the ability to handle two
>> different names for objects, then PEP 395 could run off the same
>> feature without having to mess with sys.modules.
>
> But what happens if a module contains, say, a nested class with a
> __qualname__ (assigned by the interpreter) of "module_name.A.B", and the
> module later gets a __qualname__ (assigned by the user) of
> "module_alias"?

Yeah, I don't think it works with PEP 395 in its current state. But
then, I'm not sure 395 will work at all in its current state -
definitely a work in progress, that one. However, I'll definitely keep
this aspect in mind next time I update it - even if they don't use the
same mechanism, they should at least be compatible proposals.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Chris Withers

Hi All,

Any chance the version of sphinx used to generate the docs on 
docs.python.org could be updated?


I'd love to take advantage of the "new format" intersphinx mapping:

http://sphinx.pocoo.org/ext/intersphinx.html#confval-intersphinx_mapping

...but since it looks like docs.python.org uses a version of sphinx 
that's too old for that, I can't like to:


:ref:`Foo `

...and have to link to:

`LogRecord attributes 
`__


instead :-S

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Sandro Tosi
Hello Chris,

On Wed, Aug 17, 2011 at 00:58, Chris Withers  wrote:
> Hi All,
>
> Any chance the version of sphinx used to generate the docs on
> docs.python.org could be updated?

I think what's needed first is to run a pilot: take the current 2.7
doc, update sphinx and look at what breaks, and evaluate if it's
fixable in a reasonable amount of time, or it's just too much and so
on.

Currently no-one has done that yet: would you ? :) That would helps up
quite much

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Chris Withers

On 16/08/2011 16:05, Sandro Tosi wrote:

Hello Chris,

On Wed, Aug 17, 2011 at 00:58, Chris Withers  wrote:

Hi All,

Any chance the version of sphinx used to generate the docs on
docs.python.org could be updated?


I think what's needed first is to run a pilot: take the current 2.7
doc,


Where does that live?
Where are the instructions for building the docs? (dependencies needed, etc)

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Sphinx version for Python 2.x docs

2011-08-16 Thread Nick Coghlan
On Wed, Aug 17, 2011 at 12:08 PM, Chris Withers  wrote:
> On 16/08/2011 16:05, Sandro Tosi wrote:
>> I think what's needed first is to run a pilot: take the current 2.7
>> doc,
>
> Where does that live?
> Where are the instructions for building the docs? (dependencies needed, etc)

'make html' in the Docs directory of a CPython checkout ("hg clone
http://hg.python.org/cpython";) usually does the trick.

See http://docs.python.org/dev/documenting/building.html for more
detail if the above doesn't work.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com