FWIW I just modified decimal to import numbers and made Decimal
inherit from Inexact and Real. No impact whatsoever.
--Guido
On Dec 10, 2007 1:38 PM, Greg Ewing <[EMAIL PROTECTED]> wrote:
> Paul Moore wrote:
> > On 10/12/2007, Jim Jewett <[EMAIL PROTECTED]> wrote:
> >
> >>"Don't import module X j
Paul Moore wrote:
> On 10/12/2007, Jim Jewett <[EMAIL PROTECTED]> wrote:
>
>>"Don't import module X just for me, but *if* someone else imports it,
>>then I want to do these things to/with it."
>
> That sounds to me exactly like the registration use case Christian mentioned:
>
> Register decimal.
Phillip J. Eby wrote:
> The "Importing" package implements callbacks as an extension of lazy
> imports, but it isn't the only way to do it. Christian's patch
> implements callbacks without lazy importing, although I think it still
> needs a hook (such as his previously-proposed '__lazy__' attribut
At 11:41 AM 12/10/2007 -0500, Jim Jewett wrote:
>Is there an example where you would use post-import hooks even though
>the system didn't support lazy import? The best I can come up with is
>"Don't import module X just for me, but *if* someone else imports it,
>then I want to do these things to/wi
On 10/12/2007, Jim Jewett <[EMAIL PROTECTED]> wrote:
> Is there an example where you would use post-import hooks even though
> the system didn't support lazy import? The best I can come up with is
> "Don't import module X just for me, but *if* someone else imports it,
> then I want to do these thi
On 12/10/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Jim Jewett wrote:
> > I had thought that wouldn't be run until the module was otherwise
> > loaded. Are you saying that just creating the callback forces a load
> > under lazy loading, but not under post-load hooks?
> I was saying that t
Jim Jewett wrote:
> I had thought that wouldn't be run until the module was otherwise
> loaded. Are you saying that just creating the callback forces a load
> under lazy loading, but not under post-load hooks?
The imp.imported (or whatever we name the method) is the register method
for the post
On 12/9/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Jim Jewett wrote:
> > Could you give me a use-case for post-import hooks *without* lazy imports?
> This thread was started with perfect valid and good use case. We want to
> apply ABCs to classes of optional modules like decimal and array w
Jim Jewett wrote:
> Could you give me a use-case for post-import hooks *without* lazy imports?
This thread was started with perfect valid and good use case. We want to
apply ABCs to classes of optional modules like decimal and array without
loading the module or modifying the module.
@imp.impo
On 12/9/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> The touch points between post import hooks and lazy imports
> are minimal.
Could you give me a use-case for post-import hooks *without* lazy imports?
As nearly as I can tell, either
(1) The module is already loaded (and the whole infras
Phillip J. Eby wrote:
> Thinking that they can, and actually producing a tested
> implementation of one that does not, in fact, conflict with the
> implementation of the other, are two different things.
>
> My concern is that I doubt that you can implement the post-import
> hook without in the
At 12:37 PM 12/9/2007 +1300, Greg Ewing wrote:
>Phillip J. Eby wrote:
>
> > Lazy importing is putting a module object into sys.modules, but not
> > loading its contents until you attempt to get or set a module attribute.
>
>How is that expected to be useful? If you're not going
>to access any attri
Phillip J. Eby wrote:
> Lazy importing is putting a module object into sys.modules, but not
> loading its contents until you attempt to get or set a module attribute.
How is that expected to be useful? If you're not going
to access any attributes of a module, why can you simply
not import it in
At 10:49 PM 12/8/2007 +0100, Christian Heimes wrote:
>Phillip J. Eby wrote:
> > Note that in my implementation, an entry is added to sys.modules
> > immediately, so this scenario can't happen without *replacing* the
> > sys.modules entry.
>
>I like to separate the implementation of the post import
At 10:32 PM 12/8/2007 +0100, Christian Heimes wrote:
>The pre import hook can probably be implemented in pure Python with a
>meta path hook as described in http://www.python.org/dev/peps/pep-0302/.
>I see the pre import hook as a lightweight meta path hook with an easy
>to use interface.
Which mea
Phillip J. Eby wrote:
> Note that in my implementation, an entry is added to sys.modules
> immediately, so this scenario can't happen without *replacing* the
> sys.modules entry.
I like to separate the implementation of the post import hook from lazy
modules. I think that the hook and lazy modul
Nick Coghlan wrote:
> With the new abstract base classes in Py3k, I can see it being
> worthwhile to have a standard mechanism to allow callbacks to be
> registered for execution when particular modules are first imported.
>
> For example, to handle the commented out case above:
>
>@imp.imp
At 09:55 PM 12/8/2007 +0100, Christian Heimes wrote:
>Nick Coghlan wrote:
> > I'm far from convinced that a from-scratch rewrite (particularly in C)
> > is a great idea myself - that's why I suggested a PEP to look at some of
> > the issues.
>
>Yesterday I wrote down a quick survey of codes with so
Nick Coghlan wrote:
> I'm far from convinced that a from-scratch rewrite (particularly in C)
> is a great idea myself - that's why I suggested a PEP to look at some of
> the issues.
Yesterday I wrote down a quick survey of codes with some use cases. Then
I compared my ideas with PJE's import too
On Dec 8, 2007 7:32 AM, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Phillip J. Eby wrote:
> > Misc. notes for the PEP: there should be a way to determine the laziness
> > of a module object without causing it to load. I also think you should
> > be able to set a module's __loader__, __path__, an
Phillip J. Eby wrote:
> Misc. notes for the PEP: there should be a way to determine the laziness
> of a module object without causing it to load. I also think you should
> be able to set a module's __loader__, __path__, and __file__, without
> causing it to load. That way, you can create a lazy m
At 03:56 PM 12/8/2007 +1000, Nick Coghlan wrote:
>Phillip J. Eby wrote:
> >> > Does anyone else think this is an issue worth pursuing?
> >
> > A qualified yes: the Importing package took a long time to get correct
> > under all the crazy little twists and turns of importing, including
> > correctly
Phillip J. Eby wrote:
>> > Does anyone else think this is an issue worth pursuing?
>
> A qualified yes: the Importing package took a long time to get correct
> under all the crazy little twists and turns of importing, including
> correctly handling things like the link between packages and their
At 12:33 PM 12/7/2007 +0100, Christian Heimes wrote:
>Nick Coghlan wrote:
> > For example, to handle the commented out case above:
> >
> >@imp.imported('decimal')
> >def register(decimal):
> >Inexact.register(decimal.Decimal)
>
>I like the syntax assuming that imp.imported(name) exp
Nick Coghlan wrote:
> For example, to handle the commented out case above:
>
>@imp.imported('decimal')
>def register(decimal):
>Inexact.register(decimal.Decimal)
I like the syntax assuming that imp.imported(name) expects a method that
accepts the module object as argument.
> I th
guido.van.rossum wrote:
> Modified: python/branches/py3k/Lib/numbers.py
> ==
> --- python/branches/py3k/Lib/numbers.py (original)
> +++ python/branches/py3k/Lib/numbers.py Thu Dec 6 18:45:33 2007
> @@ -43,6 +43
26 matches
Mail list logo