Re: __builtins__ in bpython

2013-01-06 Thread alex23
On Jan 6, 6:35 am, chaouche yacine wrote: > Hi. In the standard pytohon interpreter and in ipython, __builtins__ is a > module, but in bpython it's a dictionnary. Was it redefined ? I'd say it's a result of however bpython works and this: "By default, when in the __main__ module, __builtins__ i

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-14 Thread Chris Angelico
On Sun, Oct 14, 2012 at 9:36 PM, Juergen Bartholomae wrote: > Unfortunately, replacing __builtins__ at import time won't do, because > external modules (that is, .py) get imported only once when they are > accessed by the first thread, which includes (of course) setting up of > __dict__ and __buil

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-14 Thread Juergen Bartholomae
>> One possible solution is to somehow redirect every __builtins__ to a >> function that returns a different __builtins__ dictionary for each thread >> (such a function already exists). >How exactly does the code reference it? If they're simply referring to >the name __builtins__ at module level,

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-11 Thread Dave Angel
On 10/11/2012 10:16 AM, Juergen Bartholomae wrote: > Hello. > I have quite a peculiar problem. > > A little overview of our situation: > Our program enables our users to write their own python code (which they > use extensively). > Unfortunately, (due to us actually encouraging this in an earlier r

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae wrote: > One possible solution is to somehow redirect every __builtins__ to a > function that returns a different __builtins__ dictionary for each thread > (such a function already exists). How exactly does the code reference it? If they're si

Re: Long lines [was Re: __builtins__ magic behavior]

2008-09-10 Thread Gabriel Genellina
En Sun, 07 Sep 2008 19:30:07 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: Gabriel, could I please ask you to configure your news-reader software or editor to limit the length of each line of your posts to 70 characters wide, as per the common standard for email and Usenet? Your lines a

Long lines [was Re: __builtins__ magic behavior]

2008-09-07 Thread Steven D'Aprano
Gabriel, could I please ask you to configure your news-reader software or editor to limit the length of each line of your posts to 70 characters wide, as per the common standard for email and Usenet? Your lines are significantly longer than that, including one single line which is 325 character

Re: __builtins__ magic behavior

2008-09-07 Thread Patrick Maupin
On Sep 7, 2:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Inside PyFrame_New, there is a shortcut: if the new frame and > the previous one share the same globals, then the previous > builtins are copied into the new frame. Only if the globals > differ the builtins are searched in globals.

Re: __builtins__ magic behavior

2008-09-07 Thread Gabriel Genellina
En Sun, 07 Sep 2008 14:00:48 -0300, Patrick Maupin <[EMAIL PROTECTED]> escribió: > __builtins__ in 2.5.2 doesn't seem to behave like I remember it did > the last time I did some custom stuff with it, a very long time ago. > > This isn't surprising, because of ongoing optimization, but it's hard >

Re: __builtins__

2008-02-08 Thread Ben Finney
LHB <[EMAIL PROTECTED]> writes: > Marc 'BlackJack' Rintsch a écrit : > > `__builtins__` is an implementation detail, and `__builtin__` is a name > > of a module you can import. You should not use `__builtins__` but import > > `__builtin__` and inspect that instead of `__builtins__`. > Ok. Should

Re: __builtins__

2008-02-08 Thread LHB
Marc 'BlackJack' Rintsch a écrit : > On Fri, 08 Feb 2008 00:25:14 -0800, loquehumaine wrote: > >> I have seen that if I type help() at a prompt, and then 'modules', >> I'll be given a list of all modules available, thanks to this group.. >> But I have seen the differences between them and the one

Re: __builtins__

2008-02-08 Thread Marc 'BlackJack' Rintsch
On Fri, 08 Feb 2008 00:25:14 -0800, loquehumaine wrote: > I have seen that if I type help() at a prompt, and then 'modules', > I'll be given a list of all modules available, thanks to this group.. > But I have seen the differences between them and the one in > dir(__builtins__). > Why are some mod

Re: __builtins__ wreidness

2005-04-08 Thread Laszlo Zsolt Nagy
__builtins__ (plural form) is a CPython implementation detail. if you want to access the __builtin__ module, import it as usual: import __builtin__ f = __builtin__.open(...) if you're interested in CPython implementation details, study the CPython source code. Ok, I agree. I was an idio

Re: __builtins__ wreidness

2005-04-08 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: > Given this module "test.py": > > print type(__builtins__) > > I ran into a wreid thing. > > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> __builtins__ > > >>>