[Tutor] Namespace question
Alexander
rhettnaxel at gmail.com
Fri Jan 20 22:56:14 CET 2012
On Fri, Jan 20, 2012 at 2:42 PM, Emile van Sebille <emile at fenx.com> wrote:
> On 1/20/2012 10:34 AM Tino Dai said...
>
> Hi everybody,
>>
>> Got a namespace question framed inside a Django project (but I
>> still think it's pertinent to Python). We moved and broke settings.py
>> four different files in a separate directory called settings. So instead
>> of doing a
>>
>> >>> import settings
>> >>> settings.whatever
>>
>> We are having to do:
>>
>> >>> import settings
>> >>> settings.settings.whatever
>>
>
>
> You could....
>
> from settings import settings
>
> ... which then allows access as
>
> settings.whatever
>
>
> HTH,
>
> Emile
>
>
>
>> This is inconvenient and probably will break stuff especially with
>> django framework code. Is there a way to play with the namespacing to
>> have python have the former behavior rather than the latter behavior?
>>
>> Thanks,
>> Tino
>>
>>
>>
>> ______________________________**_________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>>
>
>
> ______________________________**_________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>
Yes I think you could also:
>>> import settings as settings
or
>>> import settings as s
( or whatever )
--
Alexander
7D9C597B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120120/beb64c1b/attachment.html>
More information about the Tutor
mailing list