Re: how to run python script on remote machine

2008-02-08 Thread Tim Golden
Praveena Boppudi (c) wrote: > Can anyone help me in executing python scripts on remote computer? Both > are windows machines. A fair amount depends on just you want to achieve in the wider picture. I'm going to assume that you have Python/pywin32 installed on both machines. You can, for example,

Re: sort functions in python

2008-02-08 Thread Carl Banks
On Feb 8, 10:09 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > If you expect your data to be pretty nearly sorted > already, but you just want to make sure (e.g. because a small number of > elements may have been inserted or removed since the last sort), > bubble-sort is a good choice. But if you're

Re: multi-Singleton-like using __new__

2008-02-08 Thread J Peyret
On Feb 8, 5:38 pm, Freek Dijkstra <[EMAIL PROTECTED]> wrote: If you want to subclass, my initial example did not cover that. This will, or at least, I don't have any problems with similar code: ... def __new__(cls,uri,*args,**kwds): ... try: ... return cls.cache[(cls,uri

Re: sort functions in python

2008-02-08 Thread Paddy
On 9 Feb, 01:00, t3chn0n3rd <[EMAIL PROTECTED]> wrote: > Do you think it is relatively easy to write sort algorithms such as > the common Bubble sort in Python as compared to other high level > programming langauges Hi, >From a quick google, you could compare the sources here: http://www.daniweb.c

Re: shelve.open call gives error

2008-02-08 Thread waltbrad
On Feb 8, 5:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 08 Feb 2008 06:36:53 -0200, waltbrad <[EMAIL PROTECTED]> > escribió: > > > > > Working through the Mark Lutz book Programming Python 3rd Edition. > > > A couple of modules in the "Preview" chapter give me errors. Both on a

Help Wanted (Volunteer(s))

2008-02-08 Thread Steve Holden
The Job Board needs you, please see http://pyfound.blogspot.com/2008/02/help-needed-with-python-job-board.html regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Pure Python Salsa20 Stream Cipher Implementation

2008-02-08 Thread Gabriel Genellina
En Sat, 09 Feb 2008 01:34:30 -0200, <[EMAIL PROTECTED]> escribió: > On 8 Feb., 17:18, Paul Rubin wrote: >> I don't understand why a pure python version of salsa20 would be >> interesting. Is there some application that uses salsa20, that's >> worth being able to interop

Re: Pure Python Salsa20 Stream Cipher Implementation

2008-02-08 Thread betabrain . honshu
On 8 Feb., 17:18, Paul Rubin wrote: > I don't understand why a pure python version of salsa20 would be > interesting. Is there some application that uses salsa20, that's > worth being able to interoperate with in pure python? The reason for a pure python is that it woul

Re: sort functions in python

2008-02-08 Thread Jeff Schwab
Steven D'Aprano wrote: > On Fri, 08 Feb 2008 17:00:27 -0800, t3chn0n3rd wrote: > >> Do you think it is relatively easy to write sort algorithms such as the >> common Bubble sort in Python as compared to other high level programming >> langauges > > > You realise that bubble sort is one of the wo

Re: using scons as a library

2008-02-08 Thread Miki
Hello Tim, > Hi, I've been reading up on the SCons build tool. It's intended to > work by the end-user calling 'scons' on a buildscript. However, I'd > like to use it from my own python project as an imported module, and > have my already-written classes use the Scons objects to take actions > wit

Re: Time conversion between UTC and local time

2008-02-08 Thread Miki
Hello, > I have the following problem: > There are strings describing a UTC time, e.g. " 2008-01-15 22:32:30" > and a string reflecting the time > zone e.g. "-05:00". > > What is an elegant way of getting the local time (considering DST - > daylight saving time) with that data? > The date is not i

Re: sort functions in python

2008-02-08 Thread Steven D'Aprano
On Fri, 08 Feb 2008 17:00:27 -0800, t3chn0n3rd wrote: > Do you think it is relatively easy to write sort algorithms such as the > common Bubble sort in Python as compared to other high level programming > langauges You realise that bubble sort is one of the worst possible sort algorithms possib

Re: Code block function syntax, anonymous functions decorator

2008-02-08 Thread castironpi
On Feb 8, 1:08 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Feb 8, 6:50 am, [EMAIL PROTECTED] wrote: > > > > > > > Sometimes, it's more appropriate to write > > > @call > > def f(): > >    normal_suite() > > > than > > > def f(): > >    normal_suite() > > f(). > > > It's clearer to the eye

Re: multi-Singleton-like using __new__

2008-02-08 Thread Steven D'Aprano
On Sat, 09 Feb 2008 01:20:00 +, Matt Nordhoff wrote: > Steven D'Aprano wrote: >> Except that using has_key() means making an attribute lookup, which >> takes time. > > I was going to say that, but doesn't 'in' require an attribute lookup of > some sort too, of __contains__ or whatever? I d

Re: Chinese character error

2008-02-08 Thread Mark Tolonen
"Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 8, 11:29 am, John Deas <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I made a small script to recursively copy files from a directory tree >> to an exportDir only if they have an mp3 extension : >> >> a=os.walk(os.getcwd()) >>

Re: sort functions in python

2008-02-08 Thread Jeff Schwab
t3chn0n3rd wrote: > Do you think it is relatively easy to write sort algorithms such as > the common Bubble sort in Python as compared to other high level > programming langauges http://www.codecodex.com/wiki/index.php?title=Bubble_sort -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not a Python compiler?

2008-02-08 Thread Steven D'Aprano
On Sat, 09 Feb 2008 01:11:09 +, Marc 'BlackJack' Rintsch wrote: > On Fri, 08 Feb 2008 05:12:29 -0800, Ryszard Szopa wrote: > >> Expressing simple loops as C for loops... > > You mean simple loops like ``for i in xrange(1000):``? How should the > compiler know what object is bound to the nam

Re: Why not a Python compiler?

2008-02-08 Thread Jeff Schwab
Luis M. González wrote: > On 8 feb, 22:15, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Fri, 08 Feb 2008 17:45:36 +, Grant Edwards wrote: >>> On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: Please get back on topic. This discussion is about parsecs and wookies

Re: multi-Singleton-like using __new__

2008-02-08 Thread Freek Dijkstra
J Peyret wrote: > >>> class RDFObject(object): > > ... cache ={} > ... isInitialized = False > ... def __new__(cls,uri,*args,**kwds): > ... try: > ... return cls.cache[uri] > ... except KeyError: > ... print "cache miss" > ... res = c

Re: Critique of first python code

2008-02-08 Thread Zack
On Feb 8, 4:32 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Feb 8, 3:40 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > > How about: > > > from itertools import count > > from random import randrange > > > def grow(L, depth, counter=count()): > >'''grow L by appending integers and

Re: Why not a Python compiler?

2008-02-08 Thread Luis M. González
On 8 feb, 22:15, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 08 Feb 2008 17:45:36 +, Grant Edwards wrote: > > On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > >> Please get back on topic. This discussion is about parsecs and > >> wookies now. > > > What's a "woo

Re: which one is more efficient

2008-02-08 Thread Gabriel Genellina
En Fri, 08 Feb 2008 22:45:06 -0200, ki lo <[EMAIL PROTECTED]> escribió: > I have type variable which may have been set to 'D' or 'E' > > Now, which one of following statements are more efficient > > if type =='D' or type == 'E': > > or > > if re.search("D|E", type): > > Please let me know because

Re: multi-Singleton-like using __new__

2008-02-08 Thread Matt Nordhoff
Steven D'Aprano wrote: > Except that using has_key() means making an attribute lookup, which takes > time. I was going to say that, but doesn't 'in' require an attribute lookup of some sort too, of __contains__ or whatever? has_key is probably now just a wrapper around that, so it would be one mo

Re: Why not a Python compiler?

2008-02-08 Thread Marc 'BlackJack' Rintsch
On Fri, 08 Feb 2008 17:45:36 +, Grant Edwards wrote: > On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > >> Please get back on topic. This discussion is about parsecs and >> wookies now. > > What's a "wookie" a unit of? The degree of confusion among the jury when using the Chewb

Re: Why not a Python compiler?

2008-02-08 Thread Marc 'BlackJack' Rintsch
On Fri, 08 Feb 2008 05:12:29 -0800, Ryszard Szopa wrote: > Expressing simple loops as C for loops... You mean simple loops like ``for i in xrange(1000):``? How should the compiler know what object is bound to the name `xrange` when that loop is executed? Ciao, Marc 'BlackJack' Rintsch -

Re: sort functions in python

2008-02-08 Thread Michael Spencer
t3chn0n3rd wrote: > Do you think it is relatively easy to write sort algorithms such as > the common Bubble sort in Python as compared to other high level > programming langauges yes -- http://mail.python.org/mailman/listinfo/python-list

Re: which one is more efficient

2008-02-08 Thread Michael Spencer
ki lo wrote: > I have type variable which may have been set to 'D' or 'E' > > Now, which one of following statements are more efficient > > if type =='D' or type == 'E': > > or > > if re.search("D|E", type): > > Please let me know because the function is going to called 10s of > millions of t

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

sort functions in python

2008-02-08 Thread t3chn0n3rd
Do you think it is relatively easy to write sort algorithms such as the common Bubble sort in Python as compared to other high level programming langauges -- http://mail.python.org/mailman/listinfo/python-list

Re: which one is more efficient

2008-02-08 Thread Gary Herron
ki lo wrote: > I have type variable which may have been set to 'D' or 'E' > > Now, which one of following statements are more efficient > > if type =='D' or type == 'E': > > or > > if re.search("D|E", type): > > Please let me know because the function is going to called 10s of > millions of times.

Re: Why does list have no 'get' method?

2008-02-08 Thread Ben Finney
[EMAIL PROTECTED] writes: > (would it help if I put lots of blank lines after this, so the disclaimer > is out-of-sight/out-of-mind?) Not really. It would help far more if you could stop having this disclaimer appear at all on this list (or any other list, really, but that's a matter for those l

Re: multi-Singleton-like using __new__

2008-02-08 Thread Gabriel Genellina
En Fri, 08 Feb 2008 22:04:26 -0200, Matt Nordhoff <[EMAIL PROTECTED]> escribió: > J Peyret wrote: >> - Same with using try/except KeyError instead of in cls.cache. >> Has_key might be better if you insist on look-before-you-leap, because >> 'in cls.cache' probably expends to uri in cls.cache.key

which one is more efficient

2008-02-08 Thread ki lo
I have type variable which may have been set to 'D' or 'E' Now, which one of following statements are more efficient if type =='D' or type == 'E': or if re.search("D|E", type): Please let me know because the function is going to called 10s of millions of times. Thanks Kilo -- http://mail.pyt

Re: multi-Singleton-like using __new__

2008-02-08 Thread Steven D'Aprano
On Sat, 09 Feb 2008 00:04:26 +, Matt Nordhoff wrote: > At worst, in and has_key are "about the same". Except that using has_key() means making an attribute lookup, which takes time. I'm kinda curious why you say they're "about the same" when your own timing results contradict that. Here th

Re: Why does list have no 'get' method?

2008-02-08 Thread bearophileHUGS
Carl Banks: > I think booleans should be completely disjoint from all other types, > as they are in Java. "and", "or", and "not" should accept only boolean > operands and return only boolean results. I'd like "or" and "and" (and "not") to return booleans only, to avoid bugs and make their meanin

Re: Why not a Python compiler?

2008-02-08 Thread Steve Holden
Grant Edwards wrote: > On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > >>> the compiler could do little else except translate it to something >>> like: >>> >>> (python:add a b) >> [snip more interesting considerations about compiling python] >> >> Please get back on topic. This discu

Re: Dear David

2008-02-08 Thread Steve Holden
Grant Edwards wrote: > On 2008-02-08, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: > >> I have discontinued the use of ?? a long time ago. Why >> is this still a problem? > > You're still top posting and not trimming quotes. That annoys > a lot of people. > It isn't a problem, I was mere

Re: Using a signal to terminate a programm running with an asyncore loop

2008-02-08 Thread [EMAIL PROTECTED]
On Feb 8, 4:03 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > When signal is caught handle_shutdown_signal is called.  At that point > SHUTDOWN_PERFORMED will ALWAYS be False.  Normally all you do in this function > is to set SHUTDOWN_PERFORMED to True and have a test somewhere in your main > program

Re: Using a signal to terminate a programm running with an asyncore loop

2008-02-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > On Feb 8, 7:04 am, Larry Bates <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> I'm developing a program that runs using an asyncore loop. Right now >>> I can adequately terminate it using Control-C, but as things get >>> refined I need a better way to stop it.

Re: multi-Singleton-like using __new__

2008-02-08 Thread Matt Nordhoff
J Peyret wrote: > - Same with using try/except KeyError instead of in cls.cache. > Has_key might be better if you insist on look-before-you-leap, because > 'in cls.cache' probably expends to uri in cls.cache.keys(), which can > be rather bad for perfs if the cache is very big. i.e. dict lookups >

how to run python script on remote machine

2008-02-08 Thread Praveena Boppudi (c)
Hi, Can anyone help me in executing python scripts on remote computer? Both are windows machines. Thanks, Praveena. -- http://mail.python.org/mailman/listinfo/python-list

Re: are elements of a list in sequence in list b

2008-02-08 Thread Steven D'Aprano
On Fri, 08 Feb 2008 16:39:55 +, Matthew_WARREN wrote: > Hallo, > > > I need to search list a for the sequence of list b > > First I went a=[1,2,34,4,5,6] b=[2,3,4] a in b > False You have the order of a and b mixed up there. As you have it, you are searching b for a. >

Re: Why does list have no 'get' method?

2008-02-08 Thread Gabriel Genellina
En Fri, 08 Feb 2008 13:24:19 -0200, <[EMAIL PROTECTED]> escribió: > > Matt. > (would it help if I put lots of blank lines after this, so the disclaimer > is out-of-sight/out-of-mind?) > -- > ie, from here on? No, what would help is a line containing *exactly* (dash)(dash)(space)(newline) That

Re: shelve.open call gives error

2008-02-08 Thread Gabriel Genellina
En Fri, 08 Feb 2008 06:36:53 -0200, waltbrad <[EMAIL PROTECTED]> escribió: > Working through the Mark Lutz book Programming Python 3rd Edition. > > A couple of modules in the "Preview" chapter give me errors. Both on a > shelve.open call: > > Pretty simple code, (2nd example): > =code begin=

Re: are elements of a list in sequence in list b

2008-02-08 Thread Tomek Paczkowski
[EMAIL PROTECTED] wrote: > Hallo, > > > I need to search list a for the sequence of list b > I guess most pythonic would be sth like this: [code] def naive_seq_match(sequence, pattern): """Serches for pattern in sequence. If pattern is found returns match start index, else returns No

Re: Critique of first python code

2008-02-08 Thread George Sakkis
On Feb 8, 3:40 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Feb 8, 7:20 pm, "Zack" <[EMAIL PROTECTED]> wrote: > > > > > Hi all. I'm just starting to pick up python. I wanted to play with nested > > lists so first I wrote a little bit of code to create arbitrarily nested > > lists (grow). T

Re: Critique of first python code

2008-02-08 Thread Tomek Paczkowski
Zack wrote: > Hi all. I'm just starting to pick up python. I wanted to play with nested > lists so first I wrote a little bit of code to create arbitrarily nested > lists (grow). Then I wrote a breadth first search. I'm putting this small > snippet up asking for criticism. Was there a more elegan

Re: brain stuck. whats occurring here?

2008-02-08 Thread Gabriel Genellina
En Fri, 08 Feb 2008 13:58:53 -0200, Steve Holden <[EMAIL PROTECTED]> escribió: >> "Mariano Suárez-Alvarez" <[EMAIL PROTECTED]> writes: >>> On Feb 7, 3:38 pm, [EMAIL PROTECTED] wrote: [disclaimer dozens of lines long] >>> Is this absurd signature really necessary? > That particular trailing

Re: OT: Star Wars and parsecs [was Re: Why not a Python compiler?]

2008-02-08 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-08, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > A Parsec is a fixed value (which, admittedly, presumes the culture > > developed a 360degree circle broken into degrees => minutes => > > seconds... or

Re: Critique of first python code

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 7:20 pm, "Zack" <[EMAIL PROTECTED]> wrote: > Hi all. I'm just starting to pick up python. I wanted to play with nested > lists so first I wrote a little bit of code to create arbitrarily nested > lists (grow). Then I wrote a breadth first search.  I'm putting this small > snippet up askin

Re: multi-Singleton-like using __new__

2008-02-08 Thread J Peyret
I think the metaclass stuff is a bit too black magic for a pretty simple requirement. Txs in any case for showing me the __init__ issue, I wasn't aware of it. Here's a workaround - not exactly elegant in terms of OO, with the isInitialized flag, but it works. >>> class RDFObject(object): ...

Re: are elements of a list in sequence in list b

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 5:06 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I need to search list a for the sequence of list b > > def list_contains(a, b): >     return any(a[i:i+len(b)] == b for i in range(len(a) - len(b) + 1)) > > list_contains(range(1, 7), [2, 3, 4]) > > -- > Paul H

Re: shelve.open call gives error

2008-02-08 Thread jim-on-linux
On Friday 08 February 2008 03:36, waltbrad wrote: > Working through the Mark Lutz book > Programming Python 3rd Edition. > > A couple of modules in the "Preview" > chapter give me errors. Both on a > shelve.open call: > > Pretty simple code, (2nd example): > =code begin= > import shelve >

MyHDL project!

2008-02-08 Thread Blubaugh, David A.
From: Dan Fabrizio [mailto:[EMAIL PROTECTED] Sent: Friday, February 08, 2008 2:56 PM To: Blubaugh, David A. Subject: Re: MyHDL project ! David, No problem with the mailing list, others might have some experience that could be useful. Let me know how yo

Critique of first python code

2008-02-08 Thread Zack
Hi all. I'm just starting to pick up python. I wanted to play with nested lists so first I wrote a little bit of code to create arbitrarily nested lists (grow). Then I wrote a breadth first search. I'm putting this small snippet up asking for criticism. Was there a more elegant way to do what I'm

Re: Dear David

2008-02-08 Thread Daniel Fetchinson
> I have discontinued the use of ?? a long time ago. Why is this > still a problem? Welcome to bewildering yet joyful world of usenet! It seems you are already having quite some fun! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does list have no 'get' method?

2008-02-08 Thread Carl Banks
On Feb 8, 3:38 am, [EMAIL PROTECTED] wrote: > Can't you just make a subclass of Boolean and add methods to the true/ > false, or am i running up a tree with a cat? I'm not sure what point you were trying to make, but no you can't subclass bool in Python as it is now; certainly it wouldn't be possi

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Sion Arrowsmith
In article <[EMAIL PROTECTED]>, c james <[EMAIL PROTECTED]> wrote: sample = {'t':True, 'f':False} 't' in sample == True >False > >Why is this? http://docs.python.org/lib/comparisons.html "Comparisons can be chained arbitrarily; for example, x < y <= z is equivalent to x < y and y <= z,

RE: Why not a Python compiler?

2008-02-08 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Grant Edwards > Sent: Friday, February 08, 2008 12:46 PM > To: python-list@python.org > Subject: Re: Why not a Python compiler? > > On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: >

Re: Dear David

2008-02-08 Thread Grant Edwards
On 2008-02-08, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: > I have discontinued the use of ?? a long time ago. Why > is this still a problem? You're still top posting and not trimming quotes. That annoys a lot of people. -- Grant Edwards grante Yow! MERYL

Re: Why not a Python compiler?

2008-02-08 Thread Jeff Schwab
Grant Edwards wrote: > On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > >>> the compiler could do little else except translate it to something >>> like: >>> >>> (python:add a b) >> [snip more interesting considerations about compiling python] >> >> Please get back on topic. This discu

Re: Why not a Python compiler?

2008-02-08 Thread Grant Edwards
On 2008-02-08, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: >> the compiler could do little else except translate it to something >> like: >> >> (python:add a b) > [snip more interesting considerations about compiling python] > > Please get back on topic. This discussion is about parsecs and > woo

RE: Dear David

2008-02-08 Thread Blubaugh, David A.
Steve, I have discontinued the use of ?? a long time ago. Why is this still a problem? David -Original Message- From: Steve Holden [mailto:[EMAIL PROTECTED] Sent: Friday, February 08, 2008 10:52 AM To: python-list@python.org Subject: Re: Dear David Dan Upton wrote: > On

Re: Dear David (was: MyHDL project)

2008-02-08 Thread Grant Edwards
On 2008-02-08, Dan Upton <[EMAIL PROTECTED]> wrote: > I don't know, I'm inclined to agree with him. Repeatedly > replying to bash his use of grammar or punctuation is > unnecessary. Replying to the list to mock repeatedly is > doubly unnecessary. While c.l.p is exceptionally polite and tolerant

Re: Using a signal to terminate a programm running with an asyncore loop

2008-02-08 Thread [EMAIL PROTECTED]
On Feb 8, 7:04 am, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'm developing a program that runs using an asyncore loop. Right now > > I can adequately terminate it using Control-C, but as things get > > refined I need a better way to stop it. I've developed another > >

Re: multi-Singleton-like using __new__

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 4:44 pm, Freek Dijkstra <[EMAIL PROTECTED]> wrote: > Is there a best practice on how to override __new__? > > I have a base class, RDFObject, which is instantiated using a unique > identifier (a URI in this case). If an object with a given identifier > already exists, I want to return the

Re: multi-Singleton-like using __new__

2008-02-08 Thread Guilherme Polo
2008/2/8, Freek Dijkstra <[EMAIL PROTECTED]>: > Is there a best practice on how to override __new__? > > I have a base class, RDFObject, which is instantiated using a unique > identifier (a URI in this case). If an object with a given identifier > already exists, I want to return the existing ob

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 5:20 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of c james > > Sent: Friday, February 08, 2008 12:10 PM > > To: [EMAIL PROTECTED] > > Subject: keyword 'in' not returning a bool

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 5:09 pm, c james <[EMAIL PROTECTED]> wrote: > Try this > > >>> sample = {'t':True, 'f':False} > >>> 't' in sample > True > >>> type('t' in sample) > > >>> 't' in sample == True > > False > > Why is this?  Now try>>> bool('t' in sample) == True > > True > > Can someone explain what is goi

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Richard Brodie
"c james" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 't' in sample == True > False It's comparison operator chaining: 't' in sample == True is like 't' == sample == True and is equivalent to 't' in sample and sample == True -- http://mail.python.org/mailman/listinfo

RE: keyword 'in' not returning a bool?

2008-02-08 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of c james > Sent: Friday, February 08, 2008 12:10 PM > To: python-list@python.org > Subject: keyword 'in' not returning a bool? > > Try this > > >>> sample = {'t':True, 'f':False} > >>> 't' in

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Larry Bates
c james wrote: > Try this > sample = {'t':True, 'f':False} 't' in sample > True type('t' in sample) > 't' in sample == True > False > > Why is this? Now try bool('t' in sample) == True > True > > Can someone explain what is going on? > Precedence. In: 't' in sample

Re: shelve.open call gives error

2008-02-08 Thread jim-on-linux
On Friday 08 February 2008 12:10, jim-on-linux wrote: > On Friday 08 February 2008 03:36, waltbrad > > wrote: > > Working through the Mark Lutz book > > Programming Python 3rd Edition. > > > > A couple of modules in the "Preview" > > chapter give me errors. Both on a > > shelve.open call: > > > >

Re: keyword 'in' not returning a bool?

2008-02-08 Thread Patrick Dwyer
'in' has a lower operator precedence than '==' ('t' in sample) == True would fix the operator precedence. On Feb 8, 2008 11:09 AM, c james <[EMAIL PROTECTED]> wrote: > Try this > > >>> sample = {'t':True, 'f':False} > >>> 't' in sample > True > >>> type('t' in sample) > > >>> 't' in sample ==

Re: are elements of a list in sequence in list b

2008-02-08 Thread Paul Hankin
[EMAIL PROTECTED] wrote: > I need to search list a for the sequence of list b def list_contains(a, b): return any(a[i:i+len(b)] == b for i in range(len(a) - len(b) + 1)) list_contains(range(1, 7), [2, 3, 4]) -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list

keyword 'in' not returning a bool?

2008-02-08 Thread c james
Try this >>> sample = {'t':True, 'f':False} >>> 't' in sample True >>> type('t' in sample) >>> 't' in sample == True False Why is this? Now try >>> bool('t' in sample) == True True Can someone explain what is going on? -- http://mail.python.org/mailman/listinfo/python-list

Re: shelve.open call gives error

2008-02-08 Thread jim-on-linux
On Friday 08 February 2008 03:36, waltbrad wrote: > Working through the Mark Lutz book > Programming Python 3rd Edition. > > A couple of modules in the "Preview" > chapter give me errors. Both on a > shelve.open call: > > Pretty simple code, (2nd example): from; jim-on-linux http://[EMAIL PROTEC

multi-Singleton-like using __new__

2008-02-08 Thread Freek Dijkstra
Is there a best practice on how to override __new__? I have a base class, RDFObject, which is instantiated using a unique identifier (a URI in this case). If an object with a given identifier already exists, I want to return the existing object, otherwise, I want to create a new object and add thi

Re: Why not a Python compiler?

2008-02-08 Thread Hrvoje Niksic
Ryszard Szopa <[EMAIL PROTECTED]> writes: >> The main determinant of Python's performance isn't the interpreter >> overhead, but the amount of work that must be done at run-time and >> cannot be moved to compile-time or optimized away. > > Well, I am still not convinced that Python is intrinsicall

are elements of a list in sequence in list b

2008-02-08 Thread Matthew_WARREN
Hallo, I need to search list a for the sequence of list b First I went >>> a=[1,2,34,4,5,6] >>> b=[2,3,4] >>> a in b False So ''.join([ v.__str__() for v in b ]) in ''.join([ v.__str__() for v in a ]) >>> s=SomeObject() >>> a=[1,2,3,[s,3,[4,s,9]],s,4] >>> b=[3,[s,3,[4,s,9]],s,4] >>> ''.join([

Re: Microsoft's challenger to Python

2008-02-08 Thread Dotan Cohen
On 08/02/2008, Steve Holden <[EMAIL PROTECTED]> wrote: > Daniel Fetchinson wrote: > >>> > I am not, however, an in depth language nutter, so would > >>> > appreciate any of our more learned readers comments. > > > > Maybe I'm missing the obvious here, but what does Cobra have to do > > with

NYC Python Users Meetup February Meeting Announcement....

2008-02-08 Thread John Clark
Please pardon the PSA: The New York City Python Users Meetup Group is planning on having our February meeting on February 12th, from 6:30pm - 8:00pm. For more information, please see: http://python.meetup.com/172/calendar/7082384/ Anyone in the NYC area interested in using Python, learning m

Re: How to identify which numbers in a list are within each others' range

2008-02-08 Thread Arnaud Delobelle
On Feb 8, 1:48 pm, Boris Borcic <[EMAIL PROTECTED]> wrote: > Arnaud Delobelle wrote: > > (...) > > > > > from itertools import chain > > > def overlaps(lst): > >     bounds = chain(*(((x[1],i), (x[2], i)) for i,x in enumerate(lst))) > > imho, this is a uselessly painful equivalent of > >        bou

Re: brain stuck. whats occurring here?

2008-02-08 Thread Steve Holden
Ben Finney wrote: > "Mariano Suárez-Alvarez" <[EMAIL PROTECTED]> writes: > >> On Feb 7, 3:38 pm, [EMAIL PROTECTED] wrote: >>> [disclaimer dozens of lines long] >> Is this absurd signature really necessary? > > No. > > http://www.goldmark.org/jeff/stupid-disclaimers/> > "Necessary" is depend

Re: Dear David

2008-02-08 Thread Steve Holden
Dan Upton wrote: > On Feb 7, 2008 8:59 PM, ajaksu <[EMAIL PROTECTED]> wrote: >> On Feb 7, 10:05 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: >>> I do not understand why people such as yourself cannot construct >>> anything but insults and complaints. >> I can help with that. People asked pol

Re: OT: Star Wars and parsecs [was Re: Why not a Python compiler?]

2008-02-08 Thread Grant Edwards
On 2008-02-08, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > A Parsec is a fixed value (which, admittedly, presumes the culture > developed a 360degree circle broken into degrees => minutes => > seconds... or, at least, some units compatible with the concept of an > "arc second", like 400 g

Re: How to autorun a python script when a specific user logs on?

2008-02-08 Thread jack trades
"Wolfgang Draxinger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > jack trades wrote: > > > Honestly I never even thought of that, it just sounded like a > > fun, and easy, > > project to put my mediocre programming skills to some use. > > However his main concern is internet predat

Re: Why not a Python compiler?

2008-02-08 Thread Grant Edwards
On 2008-02-07, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> wrote: > -On [20080207 22:09], Reedick, Andrew ([EMAIL PROTECTED]) wrote: >>Errr... didn't one of the novels explain it away by describing the >>kessel run as a region of space warped by black holes or other objects? >>Bragging rights

Re: How to identify which numbers in a list are within each others' range

2008-02-08 Thread Paul McGuire
On Jan 31, 10:12 am, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I have a list of numbers each with a +/- margin of error.  I need to > identify which ones overlab each other. > Here's my proposal, using arithmetic instead of sets. Looking at the problem graphically, I drew different numberlines:

Re: Why does list have no 'get' method?

2008-02-08 Thread Matthew_WARREN
> > val = BETTER foo THAN bar > > > > ;-) > > > > Cobol-strikes-back-ly yours, > > > > George > > I use a ETL language/tool that actually has a function for this kind > of thing: > > NulltoValue(value,defaultValue) > > it returns defaultValue if value is null otherwise value. even Ksh has one

Re: What do Python IDEs use for the member drop-down?

2008-02-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I realize in the new style, getattr and setattr are supposed to > reference something in a base class, but here is what I'm trying to > do: > > class tryit: > def __init__(self, a, b): > self.__dict__["a"] = a > self.__dict__["b"] = b > def __dir_

Re: Using a signal to terminate a programm running with an asyncore loop

2008-02-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I'm developing a program that runs using an asyncore loop. Right now > I can adequately terminate it using Control-C, but as things get > refined I need a better way to stop it. I've developed another > program that executes it as a child process using popen2.Popen4().

Re: Microsoft's challenger to Python

2008-02-08 Thread Steve Holden
Daniel Fetchinson wrote: >>> > I am not, however, an in depth language nutter, so would >>> > appreciate any of our more learned readers comments. > > Maybe I'm missing the obvious here, but what does Cobra have to do > with Microsoft? > (Apart from being .NET oriented.) It seems it's an open so

Re: How to autorun a python script when a specific user logs on?

2008-02-08 Thread Wolfgang Draxinger
jack trades wrote: > Honestly I never even thought of that, it just sounded like a > fun, and easy, > project to put my mediocre programming skills to some use. > However his main concern is internet predators (too much > Dateline I think) not porn, I should > have worded it differently in the OP

Re: re question

2008-02-08 Thread Hyuga
On Feb 7, 1:47 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > On Feb 7, 10:38 am, Amit Gupta <[EMAIL PROTECTED]> wrote: > > > > > Python'ites > > > I searched around "google" to find the answer to this question, but I > > can't: > > > I have a named regexp : x = re.compile("(?P[a-z]+)") > > > What I w

Re: Time conversion between UTC and local time

2008-02-08 Thread Jeroen Ruigrok van der Werven
-On [20080208 15:16], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: >What is an elegant way of getting the local time (considering DST - >daylight saving time) with that data? Perhaps using pytz might be the easiest way: http://pytz.sourceforge.net/ -- Jeroen Ruigrok van der Werven / a

Re: Why does list have no 'get' method?

2008-02-08 Thread pruebauno
On Feb 7, 4:36 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Feb 7, 4:25 pm, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > On Thu, 07 Feb 2008 15:59:13 +0100, Wildemar Wildenburger wrote: > > > Arnaud Delobelle wrote: > > >> Personally, between > > > >> * foo if foo

Time conversion between UTC and local time

2008-02-08 Thread andreas . profous
Hi all, I have the following problem: There are strings describing a UTC time, e.g. " 2008-01-15 22:32:30" and a string reflecting the time zone e.g. "-05:00". What is an elegant way of getting the local time (considering DST - daylight saving time) with that data? The date is not important, just

Re: How to identify which numbers in a list are within each others' range

2008-02-08 Thread Boris Borcic
Boris Borcic wrote: > Arnaud Delobelle wrote: > (...) >> >> from itertools import chain >> >> def overlaps(lst): >> bounds = chain(*(((x[1],i), (x[2], i)) for i,x in enumerate(lst))) > > imho, this is a uselessly painful equivalent of > > bounds = ((x[k],i) for i,x in enumerate(lst) for

Re: matplotlib install error

2008-02-08 Thread John
> Is thate really all of the error? It hints on a missing include, which > will be mentioned earlier. > > Diez platform: linux2 REQUIRED DEPENDENCIES numpy: 1.0.3.1 freetype2: found, but unknown version (no pkg-config) OPTIONAL BACKEND DEPENDENCIES

  1   2   >