Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Bryan Olson
Carl Banks wrote: Bryan Olson wrote: Paul Rubin wrote: Bryan Olson writes: BTW, class instances are usually immutable and thus don't require a mutex in the system I described. Then you are describing a language radically different from Python. That one threw me for a minute too, but I th

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Carl Banks
On Jan 23, 10:55 pm, Bryan Olson wrote: > Carl Banks wrote: > > Paul Rubin wrote: > >> Bryan Olson writes: > BTW, class instances are usually immutable and thus don't require a > mutex in the system I described. > >>> Then you are describing a language radically different from Python. >

Two import questions in Python 3.0

2009-01-23 Thread Kay Schluehr
1. I'd expected that absolute imports are used in Python 3.0 by default. I may be wrong. I've written two versions of a module sucks.py sucks.py - print ("import from lib.sucks") sucks.py - print ("import from package.sucks") The first is placed in the lib directory that

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Paul Rubin
Bryan Olson writes: > An object's __dict__ slot is *not* mutable; thus we could gain some > efficiency by protecting the object and its dict with the same lock. I > do not see a major win in Mr. Banks' point that we do not need to lock > the object, just its dict. If the dict contents don't chang

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Bryan Olson
Carl Banks wrote: Paul Rubin wrote: Bryan Olson writes: BTW, class instances are usually immutable and thus don't require a mutex in the system I described. Then you are describing a language radically different from Python. That one threw me for a minute too, but I think the idea is that t

Re: I'm a python addict !

2009-01-23 Thread Russ P.
On Jan 23, 6:58 pm, Linuxguy123 wrote: > I will never write another Perl or Bash script again. I still use bash for orchestrating the execution of a series of other scripts and/or programs (including python programs). I know you can do that in python, but I find bash simpler to use for that purp

Re: How do I get my python program to get the root password ?

2009-01-23 Thread David
Linuxguy123 wrote: I want to make a python program that I can run as a normal user that changes the permission on some device files. It will need to ask me for the root password and then run chown as root in order to do this. How do I accomplish this (easily) ? Thanks -- http://mail.python.

Re: How do I get my python program to get the root password ?

2009-01-23 Thread Grant Edwards
On 2009-01-24, Aahz wrote: > In article , > Linuxguy123 wrote: >> >>I want to make a python program that I can run as a normal user that >>changes the permission on some device files. It will need to ask me for >>the root password and then run chown as root in order to do this. >> >>How do I a

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Paul Rubin
Carl Banks writes: > > What's more, this matters when considering a GIL-less implementation. > > Typical method calls can traverse lots of mutable stuff just to find the > > function to invoke. > > Now that doesn't make sense at all. What is all this mutable stuff > you have to go through, and w

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Carl Banks
On Jan 23, 8:22 pm, Bryan Olson wrote: > Paul Rubin wrote: > > Bryan Olson writes: > >>> BTW, class instances are usually immutable and thus don't require a > >>> mutex in the system I described. > >> Then you are describing a language radically different from Python. > > > That one threw me for a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Russ P.
On Jan 23, 6:36 pm, Luis Zarrabeitia wrote: > > Makes *no* sense? There's *no* good reason *at all* for the original > > author to hide or protect internals? > > My bad, sorry. > It makes sense... if the original author is an egotist who believes he must > control how I use that library. If the

Re: is None vs. == None

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 20:33:45 -0500, Steve Holden wrote: > Steven D'Aprano wrote: >> On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: >> >>> Hi -- Some time ago I ran across a comment recommending using is >>> None instead of == None (also is not None, etc.) >> >> That entirely depend

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Steven D'Aprano
On Sat, 24 Jan 2009 01:41:35 +, Mark Wooding wrote: > Steven D'Aprano writes: ... >> As I see it, you have two coherent positions. On the one hand, you >> could be like Mark Wooding, and say that Yes you want to risk buffer >> overflows by messing with the internals > > Please, point out whe

Re: Relax Syntax for Augmented Arithmetic?

2009-01-23 Thread Aahz
In article , Steve Holden wrote: > >I understand what you are saying, but if the id() associated with a name >doesn't change after augmented assignment it seems a little wrong-headed >to argue that "the augmented assignment always binds a new value to the >name". > >What you are actually saying i

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Paul Rubin
Bryan Olson writes: > The meaning of 'immutable' is well-established in the Python > literature. Python's immutable types include tuple, frozenset, and > various kinds of numbers and strings. Class instances, not so much. But we are talking about objects as they live in the C implementation, not

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Carl Banks
On Jan 23, 7:19 pm, Paul Rubin wrote: > Bryan Olson writes: > > > BTW, class instances are usually immutable and thus don't require a > > > mutex in the system I described. > > Then you are describing a language radically different from Python. > > That one threw me

Re: How do I get my python program to get the root password ?

2009-01-23 Thread Aahz
In article , Linuxguy123 wrote: > >I want to make a python program that I can run as a normal user that >changes the permission on some device files. It will need to ask me for >the root password and then run chown as root in order to do this. > >How do I accomplish this (easily) ? The easiest

Re: I'm a python addict !

2009-01-23 Thread Aahz
In article , Linuxguy123 wrote: > >I just started using python last week and I'm addicted. Welcome! Just be aware that excessive Perl-bashing is considered somewhat tasteless on this newsgroup, but the occasional snide comment should be fine. ;-) -- Aahz (a...@pythoncraft.com) <*>

Re: I'm a python addict !

2009-01-23 Thread Paul McGuire
On Jan 23, 8:58 pm, Linuxguy123 wrote: > I just started using python last week and I'm addicted. > > I see a lot of Python in my future. Bravo, welcome, and well-said! Your sentiments mirror and resonate with those of many on this list. About 6 years ago I wanted a scripting language to wor

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Bryan Olson
Paul Rubin wrote: Bryan Olson writes: BTW, class instances are usually immutable and thus don't require a mutex in the system I described. Then you are describing a language radically different from Python. That one threw me for a minute too, but I think the idea is that the class instance

Re: Why this code is working?

2009-01-23 Thread alex23
On Jan 24, 10:56 am, r wrote: > [...] *not being afraid to open my mouth about it, fight for it, free > others from their bonds* [...] > Come down from your tower of *righteousness* Deiz, loosen up that stiff- > upper-lip and bring your brown-nosing minions with you! (emphasis mine to highlight t

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Rhodri James
On Sat, 24 Jan 2009 03:18:05 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: It is, to some extent, also part of the PHB's job to "filter the traffic" and protect both Fred and you from making too many interruptions for each other. This is especially important if you're the type of

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Paul Rubin
Steven D'Aprano writes: > For example... is this instance immutable? > > class Foo: > bar = None > > f = Foo() > f.baz = True > If so, what do you mean by immutable? If I understand Carl, yes, f is immutable. When you set f.bar, the contents of f.__dict__ changes but f itself does not chan

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 18:54:18 -0800, Carl Banks wrote: > On Jan 23, 5:48 pm, Bryan Olson wrote: >> Carl Banks wrote: >> >> [...] >> >> > BTW, class instances are usually immutable and thus don't require a >> > mutex in the system I described. >> >> Then you are describing a language radically diff

Re: Stalled ticket in Python bug tracker

2009-01-23 Thread skip
Steven> I meant bringing it to the attention of somebody who can Steven> actually commit the patch to production, or rule that the patch Steven> isn't suitable. I can't do that. Perhaps not, but you can help the process along by adding your perspective. Does it solve a problem you hav

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Paul Rubin
Bryan Olson writes: > > BTW, class instances are usually immutable and thus don't require a > > mutex in the system I described. > Then you are describing a language radically different from Python. That one threw me for a minute too, but I think the idea is that the class instance itself is immu

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Paul Rubin
"Rhodri James" writes: > My experience with medium-sized organisations (50-100 people) is that > either you talk to Fred directly, or it doesn't happen. In particular > the more people (especially PHBs) that get involved, the slower the > change will come and the less like your original requireme

Re: A different kind of interface

2009-01-23 Thread Max Erickson
bearophileh...@lycos.com wrote: > Years ago I have found this nice small program, TextCalc: > http://www.atomixbuttons.com/textcalc/ > > Despite being very limited and being not integrated with > everything else, it's so handy that for me in certain situations > it's the right tool to use when I h

I'm a python addict !

2009-01-23 Thread Linuxguy123
I just started using python last week and I'm addicted. I hate Perl. I never did learn to use it with any competence. I has to be the most obfuscated, cryptic language I've ever seen. Making it "object oriented" only makes it worse ! While I am at it, I dislike bash shell programming too. Ma

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Carl Banks
On Jan 23, 5:48 pm, Bryan Olson wrote: > Carl Banks wrote: > > [...] > > > BTW, class instances are usually immutable and thus don't require a > > mutex in the system I described. > > Then you are describing a language radically different from Python. Bzzt. Hint: aside from the reference count,

Re: strange error whilst porting to 2.6

2009-01-23 Thread Benjamin Peterson
Robin Becker NOSPAMreportlab.com> writes: > > > Well that's not really acceptable as a solution is it? :) This doesn't happen in Python 3.0, so you could port to that. :) In 2.7, the better recursion depth handling in Py3k may be backported,but the best you can do for now is not touch the recur

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Luis Zarrabeitia
Quoting Steven D'Aprano : > On Fri, 23 Jan 2009 13:07:55 -0500, Luis Zarrabeitia wrote: > > > It should be in _our_ power as the team of all participant coders on > > _our_ project to decide if we should mess with the internals or not. > > > > What makes no sense is that it should be in the ori

Re: strange error whilst porting to 2.6

2009-01-23 Thread Robin Becker
Benjamin Peterson wrote: Robin Becker NOSPAMreportlab.com> writes: python 2.6 indicates this error whilst running a script that works fine under Python 2.5. Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored I suppose this must be related to some k

Re: How do I get my python program to get the root password ?

2009-01-23 Thread Brian Allen Vanderburg II
gra...@visi.com wrote: On 2009-01-24, Linuxguy123 wrote: I want to make a python program that I can run as a normal user that changes the permission on some device files. It will need to ask me for the root password and then run chown as root in order to do this. How do I accomplish thi

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Rhodri James
On Fri, 23 Jan 2009 21:28:22 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: Mark Wooding writes: Now we come on to Fred. If Fred's across the room from me then we're back to the water-cooler. If he's on a different continent, and I know he'll be affected, I'll probably email him

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Bryan Olson
Carl Banks wrote: [...] BTW, class instances are usually immutable and thus don't require a mutex in the system I described. Then you are describing a language radically different from Python. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
Steven D'Aprano writes: > Let's be specific here. The list implementation in CPython is an array > with a hidden field storing the current length. If this hidden field was > exposed to Python code, you could set it to a value much larger than the > actual size of the array and cause buffer ove

RE: PYTHON HTTP POST WORKING EXAMPLE NEEDED

2009-01-23 Thread bruce
hey didn't get the initial post/ just what is the original poster looking for?? -Original Message- From: python-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of r Sent: Friday, January 23, 2009 5:03 PM To: py

Re: strange error whilst porting to 2.6

2009-01-23 Thread Benjamin Peterson
Robin Becker NOSPAMreportlab.com> writes: > > python 2.6 indicates this error whilst running a script that works fine > under Python 2.5. > > Exception RuntimeError: 'maximum recursion depth exceeded in > __subclasscheck__' in ignored > > I suppose this must be related to some kind of isins

Re: PYTHON HTTP POST WORKING EXAMPLE NEEDED

2009-01-23 Thread Benjamin Kaplan
On Fri, Jan 23, 2009 at 8:02 PM, r wrote: > Whatever scumbag would rate a new python's users with one start for > asking us for help is a complete low-life. Keep acting like that and > Python will fade away into the darkness forever. Could you please explain where these stars you keep talking

Re: How do I get my python program to get the root password ?

2009-01-23 Thread Grant Edwards
On 2009-01-24, Linuxguy123 wrote: > I want to make a python program that I can run as a normal > user that changes the permission on some device files. It > will need to ask me for the root password and then run chown > as root in order to do this. > > How do I accomplish this (easily) ? The s

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Steve Holden
Mark Wooding wrote: > Steven D'Aprano writes: > >> I did? Where did I make that assumption? > > I inferred it from the juxtaposition, apparently in error. Sorry. > >> What I said was that the model "The code is the whole team's ownership" >> doesn't work well for large projects. *One* reason

Re: is None vs. == None

2009-01-23 Thread Steve Holden
Steven D'Aprano wrote: > On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: > >> Hi -- Some time ago I ran across a comment recommending using is >> None instead of == None (also is not None, etc.) > > That entirely depends on whether you wish to test for something which > *is* None o

Re: writing pickle function

2009-01-23 Thread Steve Holden
Peter Otten wrote: > Steve Holden wrote: > >> Peter Otten wrote: >>> perfr...@gmail.com wrote: >>> i am using nested defaultdict from collections and i would like to write it as a pickle object to a file. when i try: from collections import defaultdict x = defaultdict(lamb

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Aaron Brady
On Jan 23, 7:01 pm, Mark Wooding wrote: > Steven D'Aprano writes: > > I did? Where did I make that assumption? > > I inferred it from the juxtaposition, apparently in error.  Sorry. > > > What I said was that the model "The code is the whole team's ownership" > > doesn't work well for large proje

Re: is None vs. == None

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 16:28:15 -0800, Gary Herron wrote: > If something > *equals* None, it also *is* None. This is a consequence of the fact > that there is only ever one value of None anywhere in the system. ... > The only way something can *equal* None is if it *is* None. >>> class Empty: ...

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
Steven D'Aprano writes: > I did? Where did I make that assumption? I inferred it from the juxtaposition, apparently in error. Sorry. > What I said was that the model "The code is the whole team's ownership" > doesn't work well for large projects. *One* reason it doesn't work for > large proj

How do I get my python program to get the root password ?

2009-01-23 Thread Linuxguy123
I want to make a python program that I can run as a normal user that changes the permission on some device files. It will need to ask me for the root password and then run chown as root in order to do this. How do I accomplish this (easily) ? Thanks -- http://mail.python.org/mailman/listinfo/p

Re: Why this code is working?

2009-01-23 Thread r
Yes promoting freedom, claiming that freedom is a good thing, and not being afraid to open my mouth about it, fight for it, free others from their bonds, makes me free. No presumption was made about the OP, the only "meaning" in my message was to free the OP from his self imposed bonds while using

Re: is None vs. == None

2009-01-23 Thread Robert Kern
Steven D'Aprano wrote: var is None is a micro-optimization, but that's not why we do it. We do it because usually the correct test is whether var *is* None and not merely equal to None. Any random object might happen to equal None (admittedly most objects don't), but only None is None. Addit

Re: Suggested improvements for IDLE (non-official)

2009-01-23 Thread r
On Jan 16, 1:55 am, Terry Reedy wrote: > > Maybe I'm misunderstanding something here, but "About Idle" in Python > > 2.6.1 (win32) says "Tk version: 8.5" As to Tk, i was referring to Themes. I may have the versions mixed up but the newest TK supports themes and i would love to get that support i

Re: Stalled ticket in Python bug tracker

2009-01-23 Thread Terry Reedy
Steven D'Aprano wrote: On Fri, 23 Jan 2009 09:35:52 -0600, skip wrote: Steven> I'm interested in this ticket in the bug tracker: Steven> http://bugs.python.org/issue2527 Steven> but it seems to have been stalled for nine months. Is there a Steven> procedure for starting it up agai

Re: Find all available Tkinter cursor names?

2009-01-23 Thread r
On Jan 23, 9:18 am, Kevin Walzer wrote: > http://wiki.tcl.tk/8674might offer some help in this regard. > Kevin Walzer > Code by Kevinhttp://www.codebykevin.com Many Thanks Kevin, this may help! -- http://mail.python.org/mailman/listinfo/python-list

Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code?

2009-01-23 Thread Casey Hawthorne
Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code? I suppose I'm thinking of an extra layer of indirection, which might slow things down to much. :) -- Regards, Casey -- http://mail.python.org/mailman/listinfo/py

Re: Dynamic methods and lambda functions

2009-01-23 Thread Mark Wooding
unine...@gmail.com writes: > class Person: > def __init__(self): > for prop in props: > setattr(self, "__" + prop[0], prop[1]) > setattr(Person, "Get" + prop[0], lambda self: getattr > (self, "__" + prop[0])) [...] > The attributes are right, but the getter ar

Re: is None vs. == None

2009-01-23 Thread Benjamin Kaplan
On Fri, Jan 23, 2009 at 7:28 PM, Gary Herron wrote: > Steven D'Aprano wrote: > > On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: > > > > > >> Hi -- Some time ago I ran across a comment recommending using is > >> None instead of == None (also is not None, etc.) > >> > > > > That entire

Re: is None vs. == None

2009-01-23 Thread Gary Herron
Steven D'Aprano wrote: > On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: > > >> Hi -- Some time ago I ran across a comment recommending using is >> None instead of == None (also is not None, etc.) >> > > That entirely depends on whether you wish to test for something which >

Re: is None vs. == None

2009-01-23 Thread Benjamin Kaplan
On Fri, Jan 23, 2009 at 6:49 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: > > > Hi -- Some time ago I ran across a comment recommending using is > > None instead of == None (also is not None, etc.) > > That entire

Re: The First Law Of comp.lang.python Dynamics

2009-01-23 Thread Tim Rowe
2009/1/23 Martin P. Hellwig : > Or you can argue that even when an argument is repeated indefinitely it > doesn't make it suddenly right. No, but it makes for a confirmation of Schluehr's law :-) -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: is None vs. == None

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 14:58:34 -0500, Gerald Britton wrote: > Hi -- Some time ago I ran across a comment recommending using is > None instead of == None (also is not None, etc.) That entirely depends on whether you wish to test for something which *is* None or something with *equals* None. Tho

Re: Where to place imports

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 17:48:19 +0100, Diez B. Roggisch wrote: > The only valid reason for doing imports inside functions is if you > otherwise get into circular dependency hell, or have modules that need > some manipulation of the sys.path before they actually can be imported. Or if you want to mak

Re: Stalled ticket in Python bug tracker

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 09:35:52 -0600, skip wrote: > Steven> I'm interested in this ticket in the bug tracker: > > Steven> http://bugs.python.org/issue2527 > > Steven> but it seems to have been stalled for nine months. Is there > a Steven> procedure for starting it up again? > > Assign

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 13:07:55 -0500, Luis Zarrabeitia wrote: > It should be in _our_ power as the team of all participant coders on > _our_ project to decide if we should mess with the internals or not. > > What makes no sense is that it should be in the original author's power > to decide, if he

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Steven D'Aprano
On Fri, 23 Jan 2009 20:09:48 +, Mark Wooding wrote: > Steven D'Aprano writes: > >> On Fri, 23 Jan 2009 13:57:52 +0100, Bruno Desthuilliers wrote: >>> Why on earth couldn't I change the code of another member of my team >>> if that code needs changes ? The code is the whole team's ownership.

Re: OCaml, Language syntax, and Proof Systems

2009-01-23 Thread Pierre Bourdon
On Sat, Jan 24, 2009 at 12:16 AM, Xah Lee wrote: > The haskell tutorials you can find online are the most mothefucking > stupid unreadable fuck. The Haskll community is almost stupid. What > they talk all day is about monads, currying, linder myer fuck type. > That's what they talk about all day.

Re: OCaml, Language syntax, and Proof Systems

2009-01-23 Thread Xah Lee
ok, i've been reading these Ocaml tutorials in the past few days: intro to ocaml, from official site http://caml.inria.fr/pub/docs/manual-ocaml/manual003.html “Objective CAML Tutorial”, most cited tutorial on the web http://www.ocaml-tutorial.org/ None of them are perfect, but much better than h

strange error whilst porting to 2.6

2009-01-23 Thread Robin Becker
python 2.6 indicates this error whilst running a script that works fine under Python 2.5. Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored I suppose this must be related to some kind of isinstance or issubclass check, but how can I locate the prob

Re: Need script to download file from a server using python script

2009-01-23 Thread Terry Reedy
Murali Murali wrote: Hi, I am fairly new to python and i am looking for a python script to download file(latest build) from the server. But, the build name changes daily. For Ex: today the build URL will be "http://mybuilds/myapp_1234.exe"; and tomorrow it will be "http://myserver/mybuilds

Re: About SCons Re: progress: compiling python2.5 under msys (specifically but not exclusively under wine) with msvcr80

2009-01-23 Thread Roumen Petrov
anatoly techtonik wrote: On Thu, Jan 22, 2009 at 12:51 AM, Roumen Petrov wrote: Against 2.3, rejected due to dependence on SCons. Also appears to have been incomplete, needing more work. No it was complete but use SCons. Most of changes changes in code you will see again in 3871. I would be

Re: seeking to improve Python skills

2009-01-23 Thread Terry Reedy
mk wrote: Jean-Paul Calderone wrote: The most significant thing missing from this code is unit tests. Developing automated tests for your code will help you learn a lot. Thanks for all the remarks, I'll restructure my code. Probably the biggest mistake was not keeping "moving average" class

Re: Where to place imports

2009-01-23 Thread Jean-Paul Calderone
On Fri, 23 Jan 2009 22:49:34 +0100, Christian Heimes wrote: Jean-Paul Calderone schrieb: BTW, if you ever find you are starting to write multi-threaded applications then you'll really regret it if you reuse code which does imports from inside functions. If two or more threads try to import a mo

Re: writing pickle function

2009-01-23 Thread Peter Otten
Steve Holden wrote: > Peter Otten wrote: >> perfr...@gmail.com wrote: >> >>> i am using nested defaultdict from collections and i would like to >>> write it as a pickle object to a file. when i try: >>> >>> from collections import defaultdict >>> x = defaultdict(lambda: defaultdict(list)) >>> >>>

Re: is None vs. == None

2009-01-23 Thread Christian Heimes
John Machin schrieb: > On Jan 24, 7:48 am, Roger wrote: >>> And, just for completeness, the "is" test is canonical precisely because >>> the interpreter guarantees there is only ever one object of type None, >>> so an identity test is always appropriate. Even the copy module doesn't >>> create cop

Re: is None vs. == None

2009-01-23 Thread Christian Heimes
Jason Scheirer schrieb: > Yes. I know that there are the PyObject* structs defined for you > Py_True, Py_False and Py_None in the C level. Confusingly enough, the > integers -5 through 257 are also singletons where the is test will > work, but any int out of that range will not. Small ints are cac

Re: is None vs. == None

2009-01-23 Thread John Machin
On Jan 24, 7:48 am, Roger wrote: > > And, just for completeness, the "is" test is canonical precisely because > > the interpreter guarantees there is only ever one object of type None, > > so an identity test is always appropriate. Even the copy module doesn't > > create copies ... > > Does the in

Re: Where to place imports

2009-01-23 Thread Christian Heimes
Jean-Paul Calderone schrieb: >> BTW, if you ever find you are starting to write multi-threaded >> applications >> then you'll really regret it if you reuse code which does imports from >> inside functions. If two or more threads try to import a module >> simultaneously then one of them might find i

Re: is None vs. == None

2009-01-23 Thread Jason Scheirer
On Jan 23, 12:48 pm, Roger wrote: > > And, just for completeness, the "is" test is canonical precisely because > > the interpreter guarantees there is only ever one object of type None, > > so an identity test is always appropriate. Even the copy module doesn't > > create copies ... > > Does the i

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Paul Rubin
Mark Wooding writes: > Now we come on to Fred. If Fred's across the room from me then we're > back to the water-cooler. If he's on a different continent, and I know > he'll be affected, I'll probably email him. If I've never heard of him > at all, well, he might just lose when someone puts my c

Re: unzip array of arrays?

2009-01-23 Thread Terry Reedy
Tobiah wrote: On Thu, 22 Jan 2009 14:13:34 -0800, Chris Rebert wrote: zip(*a)[1] (2, 4, 6) That would be what I was after. Where can I read about this mysterious use of the '*'? Python Symbol Glossary lists uses of all symbols. http://code.google.com/p/xploro/downloads/list -- http://ma

Re: The First Law Of comp.lang.python Dynamics

2009-01-23 Thread Terry Reedy
Tim Rowe wrote: 2009/1/23 Kay Schluehr : Whatever sufficiently sophisticated topic was the initially discussed it ends all up in a request for removing reference counting and the GIL. Well, maybe, but it seems to me that the real issue here is that we need to remove reference counting and the

Re: The First Law Of comp.lang.python Dynamics

2009-01-23 Thread Martin P. Hellwig
Tim Rowe wrote: 2009/1/23 Kay Schluehr : Whatever sufficiently sophisticated topic was the initially discussed it ends all up in a request for removing reference counting and the GIL. Well, maybe, but it seems to me that the real issue here is that we need to remove reference counting and the

Re: seeking to improve Python skills

2009-01-23 Thread Scott David Daniels
mk wrote: Jean-Paul Calderone wrote: The most significant thing missing from this code is unit tests. Developing automated tests for your code will help you learn a lot. However, unit tests are a tougher cookie, do you have any resource that's truly worth recommending for learning unit test

Re: unzip array of arrays?

2009-01-23 Thread Chris Rebert
On Fri, Jan 23, 2009 at 12:37 PM, Tobiah wrote: > On Thu, 22 Jan 2009 14:13:34 -0800, Chris Rebert wrote: > >> On Thu, Jan 22, 2009 at 2:04 PM, Tobiah wrote: >>> Although it's trivial to program, I wondered whether >>> there was a builtin or particularly concise way to >>> express this idea: >>>

Re: unzip array of arrays?

2009-01-23 Thread Tobiah
On Thu, 22 Jan 2009 14:13:34 -0800, Chris Rebert wrote: > On Thu, Jan 22, 2009 at 2:04 PM, Tobiah wrote: >> Although it's trivial to program, I wondered whether >> there was a builtin or particularly concise way to >> express this idea: >> >>> a = [(1, 2), (3, 4), (5, 6)] >>> field[a, 2] >> [2, 4

Re: Stalled ticket in Python bug tracker

2009-01-23 Thread Benjamin Peterson
Steven D'Aprano REMOVE-THIS-cybersource.com.au> writes: > > I'm interested in this ticket in the bug tracker: > > http://bugs.python.org/issue2527 > > but it seems to have been stalled for nine months. Is there a procedure > for starting it up again? Should I ask about it on the python-dev ma

Re: is None vs. == None

2009-01-23 Thread Steve Holden
Chris Rebert wrote: > On Fri, Jan 23, 2009 at 11:58 AM, Gerald Britton > wrote: >> Hi -- Some time ago I ran across a comment recommending using is >> None instead of == None (also is not None, etc.) My own >> testing indicates that the former beats the latter by about 30% on >> average. Not

Re: what gives with

2009-01-23 Thread Benjamin Peterson
Darren Dale gmail.com> writes: > I was talking about the behavior after doing "from __future__ import > absolute_import". I've been developing on python-2.6 using > absolute_import for weeks, knowing that I could do "from __future__ > import absolute import" on python-2.5. Now when I try to use >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
Steven D'Aprano writes: > On Fri, 23 Jan 2009 13:57:52 +0100, Bruno Desthuilliers wrote: >> Why on earth couldn't I change the code of another member of my team if >> that code needs changes ? The code is the whole team's ownership. > > That's a model that works well when you have a small team of

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
Steve Holden writes: > Annotations *have* made it into 3.0, so it's possible that the might > become usable. Remember, they'll always be optional, so those who don't > want to use them won't lose anything at all. There's a problem here. An interface has two sides. Access control annotations, a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
"Russ P." writes: > Was this library module released in source form? > > If so, then why would you care that it has enforced access > restrictions? You can just take them out, then do whatever you would > have done had they not been there to start with. I don't see how that > is any more work tha

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
Steven D'Aprano writes: > You've built something full of user serviceable parts. You've > insisted, publicly and loudly, that the ability to modify those parts > is absolutely essential, you've rejected every effort to lock down > those internals, and then when somebody does exactly what you > en

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Mark Wooding
"Russ P." writes: > OK, fine, you can change the code of another member of the team. Are > you going to check with him first, or just do it? The point is that > changing an interface requires agreement of the team members who use > that interface, whether on the calling or the implementation side

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Steve Holden
Rhamphoryncus wrote: [... eighty-eight quoted lines ...] > > I'm sorry, you're right, I misunderstood your context. Perhaps you could trim your posts to quote only the relevant context? Thanks. -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holden

Re: is None vs. == None

2009-01-23 Thread Chris Rebert
On Fri, Jan 23, 2009 at 11:58 AM, Gerald Britton wrote: > Hi -- Some time ago I ran across a comment recommending using is > None instead of == None (also is not None, etc.) My own > testing indicates that the former beats the latter by about 30% on > average. Not a log for a single instructi

Re: writing pickle function

2009-01-23 Thread Steve Holden
Peter Otten wrote: > perfr...@gmail.com wrote: > >> i am using nested defaultdict from collections and i would like to >> write it as a pickle object to a file. when i try: >> >> from collections import defaultdict >> x = defaultdict(lambda: defaultdict(list)) >> >> and then try to write to a pick

is None vs. == None

2009-01-23 Thread Gerald Britton
Hi -- Some time ago I ran across a comment recommending using is None instead of == None (also is not None, etc.) My own testing indicates that the former beats the latter by about 30% on average. Not a log for a single instruction but it can add up in large projects. I'm looking for a (semi)

Re: writing pickle function

2009-01-23 Thread Peter Otten
perfr...@gmail.com wrote: > i am using nested defaultdict from collections and i would like to > write it as a pickle object to a file. when i try: > > from collections import defaultdict > x = defaultdict(lambda: defaultdict(list)) > > and then try to write to a pickle file, it says: > > TypeE

Re: Why GIL? (was Re: what's the point of rpython?)

2009-01-23 Thread Carl Banks
On Jan 23, 7:33 am, s...@pobox.com wrote: >     >> You mean every time you access a list or dictionary or class >     >> instance, you have to acquire a mutex?  That sounds like a horrible >     >> slowdown. > >     Steve> Indeed it would, but hey, let's not let that stop us repeating >     Steve>

Re: Adding a field to a 'foreign' object from the outside

2009-01-23 Thread Scott David Daniels
Steve Holden wrote: Write a class that implements a __call__() method, and use an instance > of that class as your callback. Then the data can be stored as the callback > object's private instance data. In fact, you needn't name the method __call__. You can pass in Holder().method if you

Re: what gives with

2009-01-23 Thread Scott David Daniels
Darren Dale wrote: What is the point of providing absolute_import in __future__ if the api is completely different than the implementation in future python versions? The point is to obtain user experience with a proposed feature _before_ you fix the interface and start having to be "backwa

  1   2   >