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 __m

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

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

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-11 Thread Dave Angel
ng this in an earlier release > (!stupid!)) this meant that, in several cases, there are modules which use > __builtins__ as a kind of global dictionary, where various variables are > inserted, changed and read. > > Now, currently we are updating our program from a single-thread

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? I

__builtins__ thread-safe / __builtins__ as function?

2012-10-11 Thread Juergen Bartholomae
modules which use __builtins__ as a kind of global dictionary, where various variables are inserted, changed and read. Now, currently we are updating our program from a single-threaded to a multithreaded architecture. -> Of course, this means that the same module can now run in several threads

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
En Thu, 12 May 2011 22:59:24 -0300, Gabriel Genellina escribió: En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan escribió: I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it insid

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan escribió: I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it inside a module that was imported by another module it fails an

Peculiar Behaviour of __builtins__

2011-05-12 Thread Aman Nijhawan
I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it inside a module that was imported by another module it fails and gives an attribute error print getattr(__builtins__,'min')(range

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-30 Thread Raymond Hettinger
On Mar 27, 8:29 pm, John Ladasky wrote: > Simple question.  I use these functions much more frequently than many > others which are included in __builtins__.  I don't know if my > programming needs are atypical, but my experience has led me to wonder > why I have to import th

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Steven D'Aprano
On Mon, 28 Mar 2011 10:30:03 -0700, John Ladasky wrote: > On Mar 28, 2:25 am, Andrea Crotti wrote: >> John Ladasky writes: I almost never use them >> either, maybe also in many cases you could avoid using them... >> When for example you use them? > > To take one example: neural network programm

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Ethan Furman
John Ladasky wrote: On Mar 28, 2:25 am, Andrea Crotti wrote: I noticed some time ago in a program that needed speed that deepcopy in particular is incredibly slow, but I guess is normal since it has to copy every bit of the data structure. That may be, but when it already takes several second

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Ian Kelly
On Mon, Mar 28, 2011 at 4:55 AM, Dave Angel wrote: > I'd expect it to be very slow.  I presume it not only has to visit and > duplicate every bit of the data structure, but also has to detect loops, and > avoid infinite loops recreating them. > > This loop detection is probably an n-squared algori

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread John Ladasky
On Mar 28, 2:25 am, Andrea Crotti wrote: > John Ladasky writes: > I almost never use them either, maybe also in many cases you could avoid > using them... > When for example you use them? To take one example: neural network programming. I construct a network object (which is quite complex), tes

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Andrea Crotti wrote: John Ladasky writes: Simple question. I use these functions much more frequently than many others which are included in __builtins__. I don't know if my programming needs are atypical, but my experience has led me to wonder why I ha

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Andrea Crotti
John Ladasky writes: > Simple question. I use these functions much more frequently than many > others which are included in __builtins__. I don't know if my > programming needs are atypical, but my experience has led me to wonder > why I have to import these functions. I almo

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-27 Thread Carl Banks
On Mar 27, 8:29 pm, John Ladasky wrote: > Simple question.  I use these functions much more frequently than many > others which are included in __builtins__.  I don't know if my > programming needs are atypical, but my experience has led me to wonder > why I have to import th

Why aren't copy and deepcopy in __builtins__?

2011-03-27 Thread John Ladasky
Simple question. I use these functions much more frequently than many others which are included in __builtins__. I don't know if my programming needs are atypical, but my experience has led me to wonder why I have to import these functions. -- http://mail.python.org/mailman/listinfo/python-list

Re: why? __builtins__ key added from eval

2008-10-02 Thread Terry Reedy
Lie Ryan wrote: On Tue, 30 Sep 2008 16:04:34 -0500, William Purcell wrote: You could remove the builtin if you don't think it is necessary for you. Or you could do "dictionary comprehension" that collects only names you require (actually use generator comprehension then do a dict() conversio

Re: why? __builtins__ key added from eval

2008-10-02 Thread Lie Ryan
On Tue, 30 Sep 2008 16:04:34 -0500, William Purcell wrote: > I want to use eval to evaluate wx.TextCtrl inputs. How can I keep python > from adding the __builtins__ key to mydict when I use it with eval? > Other wise I have to __delitem__('__builtins__') everytime I use eval? &

why? __builtins__ key added from eval

2008-10-01 Thread William Purcell
I want to use eval to evaluate wx.TextCtrl inputs. How can I keep python from adding the __builtins__ key to mydict when I use it with eval? Other wise I have to __delitem__('__builtins__') everytime I use eval? >>> mydict = {'a':2,'b':3} >>> eval(&

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
tins are searched in globals. From frameobject.c: > /* If we share the globals, we share the builtins. Save a > lookup and a call. */ That was exactly my problem. Thank you for the cogent explanation. > If you want to execute some code with modified builtins, do not > change __buil

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

__builtins__ magic behavior

2008-09-07 Thread Patrick Maupin
__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 to google for '__builtins__' so I didn't really find an

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 in

Re: __builtins__

2008-02-08 Thread LHB
ave seen the differences between them and the one in >> dir(__builtins__). >> Why are some modules in __builtins__ and others don't ? (UserDict for >> example) > > `__builtins__` doesn't contain modules:: You are right... I don't know why I thought there wa

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__

2008-02-08 Thread loquehumaine
s group.. But I have seen the differences between them and the one in dir(__builtins__). Why are some modules in __builtins__ and others don't ? (UserDict for example) Why dir(__builtins__) gives me "math" but not help(__builtins__) ? What are the differences between __builtins__ an

Re: Why does __builtins__ mean different things...

2007-12-30 Thread Dustan
On Dec 22, 1:59 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Dustan wrote: > > On Dec 21, 8:11 pm, James Stroud <[EMAIL PROTECTED]> wrote: > >> I swear there is another thread going on here of which I am not aware. > > > You just keep on telling yourself that. > > Is there a cricket here? No, but

Re: Why does __builtins__ mean different things...

2007-12-22 Thread James Stroud
Dustan wrote: > On Dec 21, 8:11 pm, James Stroud <[EMAIL PROTECTED]> wrote: >> I swear there is another thread going on here of which I am not aware. > > You just keep on telling yourself that. Is there a cricket here? -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Lo

Re: Why does __builtins__ mean different things...

2007-12-22 Thread Dustan
On Dec 21, 8:11 pm, James Stroud <[EMAIL PROTECTED]> wrote: > I swear there is another thread going on here of which I am not aware. You just keep on telling yourself that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does __builtins__ mean different things...

2007-12-21 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: >> Erik Max Francis wrote: >>> randomly dropping letters in >>> names is going to result in bad behavior, so be more careful about it. Implying I've randomly dropped a letter? Where did I randomly drop a letter? > From what I can tell, the message Eri

Re: Why does __builtins__ mean different things...

2007-12-21 Thread Fredrik Lundh
James Stroud wrote: >>> Butwhat the heck? You mean if I drop an s I get predictable >>> behavior and if I don't, I get unpredictable behavior? >> >> You don't get unpredictable behavior, you just get different behavior >> you didn't expect, which is not the same thing. Python is a programm

Re: Why does __builtins__ mean different things...

2007-12-21 Thread James Stroud
Erik Max Francis wrote: > James Stroud wrote: > >> Thank you for your help. I will import the __builtin__ module as you >> have suggested--it is what I need. >> >> Butwhat the heck? You mean if I drop an s I get predictable >> behavior and if I don't, I get unpredictable behavior? > > You d

Re: Why does __builtins__ mean different things...

2007-12-21 Thread Erik Max Francis
James Stroud wrote: > Thank you for your help. I will import the __builtin__ module as you > have suggested--it is what I need. > > Butwhat the heck? You mean if I drop an s I get predictable behavior > and if I don't, I get unpredictable behavior? You don't get unpredictable behavior, you

Re: Why does __builtins__ mean different things...

2007-12-20 Thread Terry Reedy
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Butwhat the heck? You mean if I drop an s I get predictable behavior | and if I don't, I get unpredictable behavior? In 3.0, the __builtin__ module will be renamed 'builtins'. The

Re: Why does __builtins__ mean different things...

2007-12-20 Thread James Stroud
Jean-Paul Calderone wrote: > On Thu, 20 Dec 2007 14:29:35 -0800, James Stroud <[EMAIL PROTECTED]> > wrote: >> Hello all, >> >> Say I have the following module >> >> # amodule.py >> print __builtins__ >> # end of module >> >>

Re: Why does __builtins__ mean different things...

2007-12-20 Thread Jean-Paul Calderone
On Thu, 20 Dec 2007 14:29:35 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >Hello all, > >Say I have the following module > ># amodule.py >print __builtins__ ># end of module > >Then I have the following little helper script: > ># helper.py >import am

Why does __builtins__ mean different things...

2007-12-20 Thread James Stroud
Hello all, Say I have the following module # amodule.py print __builtins__ # end of module Then I have the following little helper script: # helper.py import amodule # end of helper script Now, I do this at the command line: python amodule.py And I get the following output: Which is good

Re: Type of __builtins__ changes from module import to execution?

2007-06-22 Thread Marc Christiansen
Adam Hupp <[EMAIL PROTECTED]> wrote: > I've noticed some unexpected behavior with __builtins__ during module > import. It seems that during module import __builtins__ is a dict > but at all other times it is a module. > > For example, if the file testmod.py has these

Type of __builtins__ changes from module import to execution?

2007-06-21 Thread Adam Hupp
I've noticed some unexpected behavior with __builtins__ during module import. It seems that during module import __builtins__ is a dict but at all other times it is a module. For example, if the file testmod.py has these contents: print type(__builtins__) print "has str attr

__builtins__.loglog - logging more pythonic, decent & scalable ? - Re: "No handlers could be found for logger xxx"

2006-06-03 Thread robert
nd are fulfilled by a simple direct module function as simple as: def doLog(text,level,**kwattrs): # in case write to file or whatever ... and so I simply know really what will happen. Collecting all logs is also so easy with Python, that it

Re: Proposal: add sys to __builtins__

2005-09-26 Thread Tom Anderson
On Sun, 25 Sep 2005, James Stroud wrote: > I'm into *real* purity. I would rather begin every script: > > from python import list, str, dict, sys, os > > Oh wait. I only use dict in less than 50% of my scripts: > > from python import list, str, sys, os > > That's better. What? How exactly is th

Re: Proposal: add sys to __builtins__

2005-09-25 Thread James Stroud
I'm into *real* purity. I would rather begin every script: from python import list, str, dict, sys, os Oh wait. I only use dict in less than 50% of my scripts: from python import list, str, sys, os That's better. On Saturday 03 September 2005 02:09, tiissa wrote: > I was just stating you

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Collin Winter
On 9/23/05, Peter Hansen <[EMAIL PROTECTED]> wrote: > My point, which might not have been clear, is that users are *already* > told that they shouldn't ever touch __anything__ without understanding > what it is, which is more general advice than and therefore encompasses >

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Peter Hansen
Collin Winter wrote: > The difference between __builtins__ and the other __*__ names is that > while the others shouldn't be used without understanding their > purpose, the consensus on __builtins__ seems to be that it shouldn't > be used at all. > > ... at the v

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Collin Winter
nly shouldn't have found any docs telling you to use > __builtins__ that way. > > http://www.google.ca/search?q=site%3Apython.org+__builtin__ is a pretty > quick way of finding the above docs, and while doing the same search > with __builtins__ admittedly finds lots of mailing

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Peter Hansen
Collin Winter wrote: > On 9/23/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >>__builtins__ is a CPython implementation detail. why not just let it >>be an implementation detail, and refrain from using it? it's not that >>hard, really. > Given, but I fail

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Collin Winter
On 9/23/05, Christopher Subich <[EMAIL PROTECTED]> wrote: > How would this change, if made in a minimal way, impact the "provide > alternate globals() and locals() to eval and exec" feature? Altering > __builtins__ is a half-assed way of providing some sort of security, b

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Collin Winter
On 9/23/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Collin Winter wrote: > > > As it currently stands, the type of the global __builtins__ differs > > depending on whether you're in the __main__ namespace (__builtins__ is > > a module) or not (its a dict)

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Christopher Subich
Collin Winter wrote: > Hallo all, > I'd like to propose that in Py3.0 (if not earlier), __builtins__ will > be the same type regardless of which namespace you're in. Tim Peters > has said [1] that the reason __builtins__ in __main__ is a module so > that "the curious

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Fredrik Lundh
Collin Winter wrote: > As it currently stands, the type of the global __builtins__ differs > depending on whether you're in the __main__ namespace (__builtins__ is > a module) or not (its a dict). I was recently tripped up by this > discrepancy, and googling the issue brings up h

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Tom Anderson
On Fri, 23 Sep 2005, Collin Winter wrote: > If possible, I'd like to see this go in before 3.0. The reference manual > currently states [2] that __builtins__ can be either a dict or a module, > so changing it to always be a module would still be in keeping with > this. Howeve

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Michael Hoffman
Collin Winter wrote: > If possible, I'd like to see this go in before 3.0. +1 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Single type for __builtins__ in Py3.0

2005-09-23 Thread Collin Winter
Hallo all, As it currently stands, the type of the global __builtins__ differs depending on whether you're in the __main__ namespace (__builtins__ is a module) or not (its a dict). I was recently tripped up by this discrepancy, and googling the issue brings up half-a-dozen or so c.l.p th

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Rick Wotnaz
"Michael J. Fromberger" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > In article <[EMAIL PROTECTED]>, > Rick Wotnaz <[EMAIL PROTECTED]> wrote: > >> You're right that there is no necessity for such a change. I >> was not actually talking about importing *any* module in every >> case, bu

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Patrick Maupin
Sybren Stuvel wrote: > A programming language should not be ambiguous. The choice > between importing a module and calling a function should not > depend on the availability of a (local) variable. Yeah, this behavior would be as ambiguous as if we had a system-defined search-path for modules, whe

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, Rick Wotnaz <[EMAIL PROTECTED]> wrote: > You're right that there is no necessity for such a change. I was > not actually talking about importing *any* module in every case, > but rather about importing, say, 'sys' when, for example, sys.argv > appeared in the co

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Christopher Subich
portionally) less and less. I'm -0.9 on sys (really don't like the idea but it wouldn't be awful to see it included in __builtins__, provided it's namespaced appropriately) and -1 on os. [1] Actually, it's in there three times, but they're all in the same file -- I

Re: Proposal: add sys to __builtins__

2005-09-05 Thread Rick Wotnaz
: >> >> > What would people think about adding sys to __builtins__ so >> > that "import sys" is no longer necessary? This is something I >> > must add to every script I write that's not a one-liner since >> > they have this idiom at the bottom: >>

Re: Proposal: add sys to __builtins__

2005-09-05 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, Rick Wotnaz <[EMAIL PROTECTED]> wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > > What would people think about adding sys to __builtins__ so that > > "import sys" is no long

Re: Proposal: add sys to __builtins__

2005-09-05 Thread Sybren Stuvel
Rick Wotnaz enlightened us with: > That is, a reference to xxx.func(), without a previous import of xxx > *could* be resolvable automatically, at least for those modules that > can be found in a standard location. -1 on that one. If I want to use a module, I'll write an import statement for it. Th

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Rick Wotnaz
"Terry Reedy" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > "Colin J. Williams" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Rick Wotnaz wrote: >>> +1 here. As far as I'm concerned, both os and sys could be >>> special- cased that way. That said, I would guess the

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Terry Reedy
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Rick Wotnaz wrote: >> +1 here. As far as I'm concerned, both os and sys could be special- >> cased that way. That said, I would guess the likelihood of that >> happening is 0. >> > +1 for both. Some people might pr

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Colin J. Williams
Rick Wotnaz wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>What would people think about adding sys to __builtins__ so that >>"import sys" is no longer necessary? This is something I must >>add to every sc

Re: Proposal: add sys to __builtins__

2005-09-04 Thread Xiao Jianfeng
Paul Watson wrote: >This sounds pretty interesting. How about a switch to invoke this >handling for the one-liner crowd and those who wish to use it? > > > >Somehow, I never heard any C programmers suggest that the default >processing not include the need for: > >#include > > I think it

Re: Proposal: add sys to __builtins__

2005-09-03 Thread tiissa
Michael Hoffman wrote: > To the contrary, I agree with Larry Wall that laziness is one of the > cardinal virtues of a programmer. There's lazy and too lazy. You don't want to be too lazy to even get out of bed to code in Python. Of course, with Perl, that's entirely another mattress^Wmatter. >

Re: Proposal: add sys to __builtins__

2005-09-02 Thread Paul Watson
Steve Holden wrote: > Rick Wotnaz wrote: > >> Michael Hoffman <[EMAIL PROTECTED]> wrote in >> news:[EMAIL PROTECTED]: >> >>> What would people think about adding sys to __builtins__ so that >>> "import sys" is no longer necessary? This

Re: Proposal: add sys to __builtins__

2005-09-02 Thread Michael Hoffman
tiissa wrote: > A developper should not be too lazy to add one small line in a complete > script/module. To the contrary, I agree with Larry Wall that laziness is one of the cardinal virtues of a programmer. Although my personal desire to be lazy is not at issue here--I always start new scripts

Re: Proposal: add sys to __builtins__

2005-09-02 Thread tiissa
Michael Hoffman a écrit : > MrJbQ7 wrote: > > > Besides, a better way is to use your ~/.pythonrc file for customizing > > according to your needs. > > > > A simple: > > > > echo "import sys, os" >> ~./pythonrc > > > > will do the job. > > Until someone else tries to use your script or module. A

Re: Proposal: add sys to __builtins__

2005-09-02 Thread Michael Hoffman
MrJbQ7 wrote: > Steve Holden wrote: > >>I wonder if it would be worth special-casing the AttributeError [snip] > > What is it that Tim Peters said? "Special cases aren't special > enough..." That suggestion is a little too much magic for me. > Besides, a better way is to use your ~/.pythonrc fi

Re: Proposal: add sys to __builtins__

2005-09-01 Thread MrJbQ7
Steve Holden wrote: > I wonder if it would be worth special-casing the AttributeError [snip] What is it that Tim Peters said? "Special cases aren't special enough..." Besides, a better way is to use your ~/.pythonrc file for customizing according to your needs. A simple: echo "import sys, os"

Re: Proposal: add sys to __builtins__

2005-09-01 Thread Steve Holden
Rick Wotnaz wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>What would people think about adding sys to __builtins__ so that >>"import sys" is no longer necessary? This is something I must >>add to every sc

Re: Proposal: add sys to __builtins__

2005-09-01 Thread Rick Wotnaz
Michael Hoffman <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > What would people think about adding sys to __builtins__ so that > "import sys" is no longer necessary? This is something I must > add to every script I write that's not a one-liner since they &

Proposal: add sys to __builtins__

2005-09-01 Thread Michael Hoffman
What would people think about adding sys to __builtins__ so that "import sys" is no longer necessary? This is something I must add to every script I write that's not a one-liner since they have this idiom at the bottom: if __name__ == "__main__": sys.exit(main(sys

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 w

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", "cre

__builtins__ wreidness

2005-04-08 Thread Laszlo Zsolt Nagy
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. >>