Re: [Python-3000] from .foo import * On Tue, Mar 18, 2008 at 8:32 AM, Guido van Rossum  wrote:

> I don't recall the reason; it may simply be due to the complexity, or
> possibly it would have made the _import__ API even uglier.
>

I don't recall any such issues, and I can't imagine them now. The '.' is
resolved before the fromlist is even considered, and is just a way to find
the right package to import from. Importing '*' instead of a set of names
should not be a problem.


>
> I'm fine with removing the restriction; your use case is compelling.
>
> On Tue, Mar 18, 2008 at 10:23 AM, "Martin v. LÃ¶wis" 
> wrote:
> > When I do a relative star import, I current get
> >
> >  SyntaxError: 'import *' not allowed with 'from .'
> >
> >  What's the reason for this restriction?
> >
> >  Is it ok to remove it?
> >
> >  I encountered the issue while porting Django. In
> >  django/newforms/__init__.py, they do
> >
> >  from widgets import *
> >  from fields import *
> >  from forms import *
> >  from models import *
> >
> >  In 3k, that needs to change to
> >
> >  from .widgets import *
> >  from .fields import *
> >  from .forms import *
> >  from .models import *
> >
> >  but that still won't work because of the syntax
> >  error. One solution would be to make the import
> >  explicit, but that is tedious and unmaintainable.
> >  E.g. for the widgets line, it would be
> >
> >  from .widgets import (Widget, TextInput, PasswordInput,
> >      HiddenInput, MultipleHiddenInput,
> >      FileInput, DateTimeInput, Textarea, CheckboxInput,
> >      Select, NullBooleanSelect, SelectMultiple, RadioSelect,
> >      CheckboxSelectMultiple, MultiWidget, SplitDateTimeWidget)
> >
> >  Regards,
> >  Martin
> >  _______________________________________________
> >  Python-3000 mailing list
> >  Python-3000@python.org
> >  http://mail.python.org/mailman/listinfo/python-3000
> >  Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/guido%40python.org
> >
>
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/
> )
> _______________________________________________
> Python-3000 mailing list
> Python-3000@python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/thomas%40python.org
>



-- 
Thomas Wouters 

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
