Re: Conditional iteration

2006-12-14 Thread Carl Banks
at wrote: > Carl Banks wrote: > > > at wrote: > >> Well, all I can say that for me as a user it would make sense... > > > > Which is, like, step one out of a hundred for getting a syntax change > > into the language. > > > >> Curiosity: in what sense is it redundant? > > > > It creates syntactical

Re: Sorting Multidimesional array(newbie)

2006-12-14 Thread Brian Mills
Fredrik Lundh wrote: > Brian Mills wrote: > > > There's another (IMHO more readable) way to do it if you can afford > > defining a short little "compare" function, and telling .sort() > > to use that instead of its default: > > > def myListCmp(lst1, lst2): > > ... if lst1[0] < lst2[0]: ret

Re: how to determine Operating System in Use?

2006-12-14 Thread Prateek
also try: sys.platform if sys.platform == "darwin": macStuff() elif sys.platform == "win32": linuxStuff() James Cunningham wrote: > On 2006-12-13 19:28:14 -0500, [EMAIL PROTECTED] said: > > > > > > > On Dec 13, 6:32 pm, "Ian F. Hood" <[EMAIL PROTECTED]> wrote: > >> Hi > >> In typically

Re: how to determine Operating System in Use?

2006-12-14 Thread Prateek
eeps! typo. > if sys.platform == "darwin": > macStuff() > elif sys.platform == "win32": > winStuff() > Not sure what the string is on linux. Just fire up the interpreter and try it. Prateek Prateek wrote: > also try: > > sys.platform > > if sys.platform == "darwin": > macStuff() > e

Re: merits of Lisp vs Python

2006-12-14 Thread Ken Tilton
Paul Rubin wrote: > Ken Tilton <[EMAIL PROTECTED]> writes: > Man that whole thing is messy. >> >>I do not see much difference, except that the character count is 25% >>less in the macro version: > > > The macro calls aren't so bad, but the macro definition is pretty > horrendous. (a) /Pr

Re: Conditional iteration

2006-12-14 Thread at
By the way, I think by approving a = b if condition else c used to avloind if condition: a = b else: a = c which is dealing with same psychological problem, Guido also recognizes some need... Is it redundant according to your criteria, yes I would say: a = {True: a, False: c}

Re: Stupid email disclaimers (was: [unicode] inconvenient unicodeconversion of non-string arguments)

2006-12-14 Thread Holger Joukl
[EMAIL PROTECTED] schrieb am 13.12.2006 23:10:38: > [...] > In all likelihood, the OP isn't choosing specifically to attach it; > these things are often done to *every* outgoing message at an > organisational level by people who don't think the issue through very > well. > > http://goldmark.org

Survey environment for Python?

2006-12-14 Thread exhuma.twn
Hi, Just recently I had to take over support for legacy software written in Blaise (www.cbs.nl). As I did not know of this "Programming Language" until one year ago I started to learn it. Well more like "read it" as it's very very easy/simple. However, I don't feel comfortable in that languag

Re: Conditional iteration

2006-12-14 Thread at
Hi Paul, I appreciate your explanation! Thanx @ Paul Rubin wrote: > at <[EMAIL PROTECTED]> writes: >> > for x in (x for x in [-2, -1, 0, 1, 2, 3, 4] if x > 0): >> >... more code ... > >> Do you know if this generates a new list internally (memory consumption?) > > It does not. Th

Re: Sorting Multidimesional array(newbie)

2006-12-14 Thread Peter Otten
Brian Mills wrote: >> but using a compare function instead of a key mapper is not good advice, >> in general. brief discussion here: >> http://effbot.org/pyfaq/i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python > Is this mostly because of the stability problem described

Re: merits of Lisp vs Python

2006-12-14 Thread Ken Tilton
Paul Rubin wrote: > Ken Tilton <[EMAIL PROTECTED]> writes: > >>btw, you called the defskill messy (repeated below) "messy". The only >>text not specific to absolute value is D-E-F-S-K-I-L-L. > > > No, the messiness was not in the macro instantation (defskill blah...), > but in the defmacro tha

Re: Defining classes

2006-12-14 Thread Michele Simionato
Nick Maclaren wrote: > It would be much cleaner not to have to fiddle with static > members after the class is initialised. You can hide the fiddling, for instance with the trick explained here: http://www.phyast.pitt.edu/~micheles/python/classinitializer.html Michele Simionato -- http:/

Re: How do I edit a PythonWin path to import custom built modules???

2006-12-14 Thread Fredrik Lundh
BartlebyScrivener wrote: >> what do you get if you do: > >>> python -S >> ... import sys sys.path > > ['', 'C:\\WINDOWS\\system32\\python24.zip', 'd:\\python', > 'C:\\Python24\\DLLs', 'C:\\Python24\\lib', > 'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk', 'C:\ > \Python24']

Re: merits of Lisp vs Python

2006-12-14 Thread jurgen_defurne
Ken Tilton wrote: > George Sakkis wrote: > > [EMAIL PROTECTED] wrote: > > > >>Okay, since everyone ignored the FAQ, I guess I can too... > >> > >>Mark Tarver wrote: > >> > >>>How do you compare Python to Lisp? What specific advantages do you > >>>think that one has over the other? > >> > >>(Commo

Re: YouTube written in Python

2006-12-14 Thread John Nagle
Terry Reedy wrote: > In a thread on the PyDev list, Guido van Rossum today wrote: > >>And I just found out (after everyone else probably :-) that YouTube is >>almost entirely written in Python. Probably just the web page maintenance system is in Python. I doubt that actual video passes throug

Re: Sorting Multidimesional array(newbie)

2006-12-14 Thread Fredrik Lundh
Brian Mills wrote: > >> but using a compare function instead of a key mapper is not good advice, >> in general. brief discussion here: >> http://effbot.org/pyfaq/i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python > > Is this mostly because of the stability problem descr

Re: Newbie Question - Checkboxes

2006-12-14 Thread Leanne
John Machin wrote: >> I'd try this: > > if isinstance(returned_value, basestring): > returned_value = [returned_value] > for item in returned_value: > do_something_with(item) > > HTH, > John This sounds like a neat way of doing it, thanks! -- http://mail.python.org/mailman/listinfo/pyt

Re: The Famous Error Message: "ImportError: No module named python_script"

2006-12-14 Thread Gabriel Genellina
At Thursday 14/12/2006 03:44, rich murphy wrote: The tutorial says: "For instance, use your favorite text editor to create a file called fibo.py in the current directory with the following contents:" So, I assumed "the current directory" is C:\Python25 which did not work. Then I placed the fibo

Re: merits of Lisp vs Python

2006-12-14 Thread Andrew Reilly
On Thu, 14 Dec 2006 03:01:46 -0500, Ken Tilton wrote: > You just > aren't used to thinking at a level where one is writing code to write code. Firstly, I'm looking into lisp because my current python project is too full of boilerplate :-) and too slow. Coming from a C and assembler background,

variables with dynamicly generated names

2006-12-14 Thread avlee
Hello Is it possible to use in python variables with dynamicly created names ? How ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-14 Thread Ken Tilton
Andrew Reilly wrote: > On Thu, 14 Dec 2006 03:01:46 -0500, Ken Tilton wrote: > > >>You just >>aren't used to thinking at a level where one is writing code to write code. > > > Firstly, I'm looking into lisp because my current python project is too > full of boilerplate :-) and too slow. Com

Re: Conditional iteration

2006-12-14 Thread Duncan Booth
at <[EMAIL PROTECTED]> wrote: > By the way, > > I think by approving > > a = b if condition else c > > used to avloind > > if condition: > a = b > else: > a = c Neither of those is much of an improvement over the other, and in fact if b or c are complex expressions I would de

Re: variables with dynamicly generated names

2006-12-14 Thread Diez B. Roggisch
avlee schrieb: > Hello > > Is it possible to use in python variables with dynamicly created names ? > How ? In such cases, use a dictionary: vars = {} for some_name, some_value in some_values_generating_thing(): vars[some_name] = some_value Diez -- http://mail.python.org/mailman/listinf

Re: merits of Lisp vs Python

2006-12-14 Thread Paul Rubin
Ken Tilton <[EMAIL PROTECTED]> writes: > Again, that is precisely the point of macrology (in cases like > this). When a pattern will repeat a sufficient number of times, and a > function cannot handle the job, But this is not a case where a function can't handle the job. > Check out the latest, p

Re: variables with dynamicly generated names

2006-12-14 Thread Paul Rubin
avlee <[EMAIL PROTECTED]> writes: > Is it possible to use in python variables with dynamicly created names ? Yes, but don't. > How ? You almost certainly want to use something like a dictionary instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-14 Thread Ken Tilton
Ken Tilton wrote: > > > Andrew Reilly wrote: > >> On Thu, 14 Dec 2006 03:01:46 -0500, Ken Tilton wrote: >> >> >>> You just aren't used to thinking at a level where one is writing code >>> to write code. >> >> >> >> Firstly, I'm looking into lisp because my current python project is too >> ful

Re: variables with dynamicly generated names

2006-12-14 Thread Gabriel Genellina
At Thursday 14/12/2006 05:50, avlee wrote: Is it possible to use in python variables with dynamicly created names ? How ? Use a dictionary: d = {} d[almost_arbitrary_key] = value -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio par

Re: Survey environment for Python?

2006-12-14 Thread Kay Schluehr
exhuma.twn schrieb: > Hi, > > Just recently I had to take over support for legacy software written in > Blaise (www.cbs.nl). I don't understand the meaning of the link. Do you mean this language? http://blaise.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Defining classes

2006-12-14 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Michael Spencer <[EMAIL PROTECTED]> writes: |> |> "instantiation" (i.e., calling the __new__ method) of new-style classes |> can return whatever you like, but I'm not sure how that helps. Yes and no. While it can return any value you like, it can't act as a clas

Re: Defining classes

2006-12-14 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Michele Simionato" <[EMAIL PROTECTED]> writes: |> Nick Maclaren wrote: |> > It would be much cleaner not to have to fiddle with static |> > members after the class is initialised. |> |> You can hide the fiddling, for instance with the trick explained here: |> |>

Re: merits of Lisp vs Python

2006-12-14 Thread David Golden
William James wrote: > Actually, it's 'among', not 'amongst', except to those who are > lisping, degenerate pansies. > lisping: "amongst" => "amongthpt" ? "amongst" is a fairly common british english variant of "among". > Some pronunciations and usages "froze" when they reached the >  Americ

pwinauto to remote automate a GUI ?

2006-12-14 Thread baitelli
Hi! pywinauto is a set of python modules to automate the Microsoft Windows GUI. With the lines below we start and atomates the apllication Notepad: from pywinauto import application app = application.Application() app.start('C:\Notepad.exe') ... pywinauto automation code Question: Is it possib

javadoc equivalent?

2006-12-14 Thread Kant, Fredrik
Hi! I saw this question, have you tried the standard python module pydoc (you find it under Lib in the standard installation)? Fredrik Kant Phone: +46 (8) 4100 9795 Mobile: +46 (733) 38 50 42 Email: [EMAIL PROTECTED] TradeTech Sturegatan 46 SE-114 36 Stockholm, S

ANN: Pyflix-0.1

2006-12-14 Thread George Sakkis
Hi there, I'm happy to announce Pyflix, a small Python package that provides an easy entry point for those wishing to get up and running at the Netflix Prize competition (http://www.netflixprize.com/). For those who are not aware of it, the Netflix Prize challenge is to write a recommendation algo

open a directory in widows

2006-12-14 Thread Bell, Kevin
If I want "C:\temp" to pop open on screen, how do I do it? -- http://mail.python.org/mailman/listinfo/python-list

Easier way yo use Py2exe

2006-12-14 Thread Scheol Service
The directions are confusing. Can someone clear them up. Intructions Location: http://www.py2exe.org/index.cgi/Tutorial OS: Windows XP Pro. -- http://mail.python.org/mailman/listinfo/python-list

error: Error -5 while decompressing data from struct.unpack

2006-12-14 Thread Gary Robinson
One of our users received an exception, "error: Error -5 while decompressing data from struct.unpack," in the course of a struct.unpack operation. I haven't been able to discern what Error -5 is in this context. In experiments here I wasn't able to elicit that exception. There's a system excep

logging

2006-12-14 Thread Lutz Steinborn
Hello, I need to log each and only this loglevel to a different file. So for example all INFO to info.log and all ERROR to error.log. And I need a master logfile with all messages. How can I do this ? Any example ? Kindly regards Lutz http://www.4c-wohnen.de http://www.4c-parfum.de -- http:

Re: Snake references just as ok as Monty Python jokes/references inpython community? :)

2006-12-14 Thread Hendrik van Rooyen
"John Machin" <[EMAIL PROTECTED]> wrote: > Ah yes, exposure to Blackadder helps enormously ... after some hours > spent trying to understand things like metaclasses, it's helpful to > know what to do: put a pencil or chopstick up each nostril, wear your > underpants on your head, and sit there m

New York City Python Users Group meeting is planned for Dec. 12th @ 6pm - please RSVP!

2006-12-14 Thread John Clark
Greetings! The next New York City Python Users Group meeting is this Tuesday, Dec. 12th, 6pm at at the Millennium Partners office at 666 Fifth Avenue on the 8th Floor. We welcome all those in the NYC area who are interested in Python to attend. However, we need a list of first and last names to

Working w/ Yield

2006-12-14 Thread Javier Subervi
Hi; I'm trying to tweak a script I found here: http://zopelabs.com/cookbook/1118667115 to get it to do what I want. I'm no wizard at Python, much less newfangled tools like yield. I understand that one cannot use "return" when working with yield, but I don't understand how to achieve the same res

Client side COM and Python Problem

2006-12-14 Thread Mark
Hey Guys, Im new to working with com but i only want to do one thing. I have activestate python and am trying to get python to run a simple function in a com enabled 3d program called 3dsmax. If i try and execute a function over the com interface it works fine as long as i dont try and run the

Re: Inconsistency in dictionary behaviour: dict(dict) not calling __setitem__

2006-12-14 Thread Almad
Thanks to everybody for replies, I'm now satisfied ^_^ Almad -- http://mail.python.org/mailman/listinfo/python-list

RE: pwinauto to remote automate a GUI ?

2006-12-14 Thread Tim Golden
[baitelli] | pywinauto is a set of python modules to automate the | Microsoft Windows GUI. | With the lines below we start and atomates the apllication Notepad: | | from pywinauto import application | app = application.Application() | app.start('C:\Notepad.exe') | ... pywinauto automation code

Re: About alternatives to Matlab

2006-12-14 Thread Jon Harrop
Paul Rubin wrote: > Interesting, where do I get it, and is there source? I've never been > interested in Mono but maybe this is a reason. How does the compiled > code compare to OCaml or MLton code? GC intensive code is 2-4x slower than OCaml or 4-8x slower than MLton. Floating point intensive c

Re: merits of Lisp vs Python

2006-12-14 Thread [EMAIL PROTECTED]
Neil Cerutti wrote: > On 2006-12-13, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > Try reading again. In Lisp, you use () and *your editor* > > automatically indents according to the universal standard, or > > you leave it sloppy until other folks reading your code > > convince you to get a p

Re: pwinauto to remote automate a GUI ?

2006-12-14 Thread Tim Golden
Tim Golden wrote: [... snip horrendous company-generated sig/disclaimer ...] Sorry about that, folks. We've started using a new server-based sig generation thing so I'll have to start not sending via company email! TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-14 Thread Andrew Reilly
On Thu, 14 Dec 2006 04:06:26 -0500, Ken Tilton wrote: > Ken Tilton wrote: >> Andrew Reilly wrote: >>> However, in this particular instance, I'm inclined to wonder why >>> meta-programming is the right answer, rather than just doing all of the >>> interpolation and what-not at run-time, based on a b

Re: Conditional iteration

2006-12-14 Thread Diez B. Roggisch
> Is it redundant according to your criteria, yes I would say: > > a = {True: a, False: c}[condition] > > or > > a = [c, a][condition] > > would yield exactly the same even in one sentence Obviously it is _not_ the exact same. def fac(n): return n * fac(n-1) if n else 1 Try that wit

Re: merits of Lisp vs Python

2006-12-14 Thread [EMAIL PROTECTED]
Christophe wrote: > [EMAIL PROTECTED] a écrit : > > Bjoern Schliessmann wrote: > >> Robert Uhl wrote: > >> > >>> Because it's the language for which indentation is automatically > >>> determinable. That is, one can copy/paste a chunk of code, hit a > >>> key and suddenly everything is nicely inde

Re: About alternatives to Matlab

2006-12-14 Thread Jon Harrop
Filip Wasilewski wrote: > Jon Harrop wrote: >> Filip Wasilewski wrote: >> > Jon, both Python and Matlab implementations discussed here use the >> > lifting scheme, while yours is a classic convolution based approach. >> >> I've done both in OCaml. The results are basically the same. > > Have you t

Re: open a directory in widows

2006-12-14 Thread Tim Golden
Bell, Kevin slcgov.com> writes: > > If I want "C:\temp" to pop open on screen, how do I do it? import os os.startfile (r"c:\temp") -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-14 Thread Christophe
Robert Uhl a écrit : > Christophe <[EMAIL PROTECTED]> writes: >> Saying that the French units are technically worse than standard units >> is a troll of very poor quality and a very weak argument. > > It was just an example that the argument from popularity is invalid. > However, I (and many other

remove matching pairs

2006-12-14 Thread Evan
Is there a simple way to to identify and remove matching pairs from 2 lists? For example: I have a=[2, 5, 3, 4, 7, 2, 2, 4, 8, 1] b=[7, 3, 5, 8, 1, 7, 4, 8, 2, 6] and I want to get this: a=[2, 5, 3, 4, 7, 2, 8, 1] b=[7, 3, 5, 8, 1, 4, 2, 6] There are recurring pairs of (2, 7) and (4, 8), and

tuple.index()

2006-12-14 Thread Nick Maclaren
Why doesn't the tuple type have an index method? It seems such a bizarre restriction that there must be some reason for it. Yes, I know it's a fairly rare requirement. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list

Re: Survey environment for Python?

2006-12-14 Thread Paddy
On Dec 14, 9:12 am, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: > exhuma.twn schrieb: > > > Hi, > > > Just recently I had to take over support for legacy software written in > > Blaise (www.cbs.nl).I don't understand the meaning of the link. Do you mean > > this language? > > http://blaise.sourcef

Re: remove matching pairs

2006-12-14 Thread Tim Chase
> Is there a simple way to to identify and remove matching pairs from 2 > lists? > > For example: > > I have > > a=[2, 5, 3, 4, 7, 2, 2, 4, 8, 1] > b=[7, 3, 5, 8, 1, 7, 4, 8, 2, 6] > > and I want to get this: > > a=[2, 5, 3, 4, 7, 2, 8, 1] > b=[7, 3, 5, 8, 1, 4, 2, 6] Well, with a few caveats

Re: Conditional iteration

2006-12-14 Thread Roberto Bonvallet
at wrote: > I think by approving > > a = b if condition else c > > used to avloind > > if condition: >a = b > else: >a = c > > which is dealing with same psychological problem, Guido also recognizes some > need... GvR did not introduce the new conditional syntax because he felt

Re: tuple.index()

2006-12-14 Thread Fredrik Lundh
Nick Maclaren wrote: > Why doesn't the tuple type have an index method? It seems such a > bizarre restriction that there must be some reason for it. hah! not being able to remove or add things to tuples is an even bizarrer restriction! -- http://mail.python.org/mailman/listinfo/python-list

Re: speed of python vs matlab.

2006-12-14 Thread Christophe
Chao a écrit : > My Bad, the time used by python is 0.46~0.49 sec, > I tried xrange, but it doesn't make things better. > > import time > tic = time.time() > a = 1.0 > > array = range(1000) > > for i in array: > for j in array: > a = a + 0.1 > > toc = time.time() > print toc-tic,' ha

Re: error: Error -5 while decompressing data from struct.unpack

2006-12-14 Thread Fredrik Lundh
Gary Robinson wrote: > One of our users received an exception, "error: Error -5 while > decompressing data from struct.unpack," in the course of a > struct.unpack operation. I haven't been able to discern what Error -5 > is in this context. In experiments here I wasn't able to elicit that > ex

Re: speed of python vs matlab.

2006-12-14 Thread Roberto Bonvallet
Chao wrote: > My Bad, the time used by python is 0.46~0.49 sec, > I tried xrange, but it doesn't make things better. Actually it does: it doesn't waste time and space to create a big list. -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-14 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> writes: |> |> > Why doesn't the tuple type have an index method? It seems such a |> > bizarre restriction that there must be some reason for it. |> |> hah! not being able to remove or add things to tuples is an even |> bizarrer

Routine for prefixing '>' before every line of a string

2006-12-14 Thread Sanjay
Hi All, Is somewhere a routine useful to convert a string to lines of maxsize, each prefixed with a '>'. This is a typical requirement for 'keeping existing text while replying to a post in a forum'. It can be developed, but if something obvious is already there(I being new to python might not be

Re: merits of Lisp vs Python

2006-12-14 Thread Christophe
[EMAIL PROTECTED] a écrit : > Christophe wrote: >> Call us when you have an editor that reads your mind and writes the () >> for you. > > This is an irrelevancy. Typos that drop printing characters in either > language will generally cause changes to the semantics. Lisp > programmers, incidentally

Re: Easier way yo use Py2exe

2006-12-14 Thread Fredrik Lundh
Scheol Service wrote: > The directions are confusing. Can someone clear them up. > > Intructions Location: http://www.py2exe.org/index.cgi/Tutorial looks pretty straightforward to me. create a simple python script, write a short setup.py file that points to the script, run it to get an executa

Re: tuple.index()

2006-12-14 Thread Glenn Hutchings
Nick Maclaren wrote: > Why doesn't the tuple type have an index method? It seems such a > bizarre restriction that there must be some reason for it. In fact, tuples have no non-__underscored__ methods at all. The list count() method would also be useful for tuples, since it doesn't modify anythi

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 12/14/06, Nick Maclaren <[EMAIL PROTECTED]> wrote: > Well, if that were so, it would explain things. But lists AREN'T > necessarily homogeneous! > > >>> a=[52,"abc",[1,2],5.6] > >>> print repr(a) > [52, 'abc', [1, 2], 5.5996] It's not a technical restriction, as I said, but it's wh

Re: tuple.index()

2006-12-14 Thread Fredrik Lundh
Nick Maclaren wrote: > My understanding of the difference between a tuple and a list is > PRECISELY that the former is immutable and the latter mutable. while tuples can be used as "frozen lists", that's definitely not what they are, from a design perspective. just like in math [1], a Python tu

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 11:24:04 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > Why doesn't the tuple type have an index method? It seems such a > bizarre restriction that there must be some reason for it. Yes, > I know it's a fairly rare requirement. It's because, philosophically, a Python tuple isn'

Re: remove matching pairs

2006-12-14 Thread Evan
That's great, thank you, the caveats are no matter! -Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-14 Thread Neil Cerutti
On 2006-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Neil Cerutti wrote: >> On 2006-12-13, [EMAIL PROTECTED] >> <[EMAIL PROTECTED]> wrote: >> > Expressions keep the same meaning even if you have to start >> > breaking them across lines, etc. >> >> Yes, it's the same way in Python. Of cou

Re: Pythonic style involves lots of lightweight classes (for me)

2006-12-14 Thread Andrea Griffini
metaperl wrote: > The above program started out as a list of dictionaries, but I > like the current approach much better. There is even a common idiom for this... class Record(object): def __init__(self, **kwargs): self.__dict__.update(kwargs) This way you can use user

Re: Routine for prefixing '>' before every line of a string

2006-12-14 Thread Boris Borcic
Sanjay wrote: > Hi All, > > Is somewhere a routine useful to convert a string to lines of maxsize, > each prefixed with a '>'. This is a typical requirement for 'keeping > existing text while replying to a post in a forum'. > > It can be developed, but if something obvious is already there(I bein

PyThreadState_SetAsyncExc (nThreadId ??????, exc);

2006-12-14 Thread iwl
what is the nThreadId-Parameter of PyThreadState_SetAsyncExc? I try to implement a Terminate-Button in my C-Prog for my embedded Python, but its hard to find an example how to stop an interpreter running in an thread. I found no other Python C-App-Func returning such a parameter. -- http://mail

Re: Survey environment for Python?

2006-12-14 Thread exhuma.twn
Kay Schluehr wrote: > exhuma.twn schrieb: > > > Hi, > > > > Just recently I had to take over support for legacy software written in > > Blaise (www.cbs.nl). > > I don't understand the meaning of the link. Do you mean this language? > > http://blaise.sourceforge.net/ Not quite ;) Sorry for being t

Re: merits of Lisp vs Python

2006-12-14 Thread [EMAIL PROTECTED]
Neil Cerutti wrote: > On 2006-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Neil Cerutti wrote: > >> On 2006-12-13, [EMAIL PROTECTED] > >> <[EMAIL PROTECTED]> wrote: > >> > Expressions keep the same meaning even if you have to start > >> > breaking them across lines, etc. > >> > >> Y

Re: Routine for prefixing '>' before every line of a string

2006-12-14 Thread Peter Otten
Sanjay wrote: > Is somewhere a routine useful to convert a string to lines of maxsize, > each prefixed with a '>'. This is a typical requirement for 'keeping > existing text while replying to a post in a forum'. >>> import textwrap >>> format = textwrap.TextWrapper(20, initial_indent="] ", subseq

Re: How do I edit a PythonWin path to import custom built modules???

2006-12-14 Thread BartlebyScrivener
Fredrik Lundh wrote: > is this an ActiveState build? Yes, I think I mentioned it further up the thread. > what's sys.prefix and sys.exec_prefix set to on your machine, btw? 'C:\\Python24' No big deal. I always just assumed that it found my scripts via the path variable. As long as it finds the

Multiple inheritance and __slots__

2006-12-14 Thread [EMAIL PROTECTED]
Hi all, >From the google search, it seems its not possible to do the following. >>> class Test1(object): ... __slots__ = ['a'] ... >>> class Test2(object): ... __slots__ = ['b'] ... >>> class Test3(Test1,Test2): ... __slots__ = ['c'] ... Traceback (most recent call last): File "", li

Re: Routine for prefixing '>' before every line of a string

2006-12-14 Thread Roberto Bonvallet
Sanjay wrote: > Is somewhere a routine useful to convert a string to lines of maxsize, > each prefixed with a '>'. This is a typical requirement for 'keeping > existing text while replying to a post in a forum'. Take a look to the textwrap module: http://docs.python.org/lib/module-textwrap.html H

Re: merits of Lisp vs Python

2006-12-14 Thread Neil Cerutti
On 2006-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Neil Cerutti wrote: >> On 2006-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > >> > Neil Cerutti wrote: >> >> On 2006-12-13, [EMAIL PROTECTED] >> >> <[EMAIL PROTECTED]> wrote: >> >> > Expressions keep the same meaning even if

Re: Multiple inheritance and __slots__

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 05:23:33 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi all, > >From the google search, it seems its not possible to do the following. > > >>> class Test1(object): > ... __slots__ = ['a'] > ... > >>> class Test2(object): > ... __slots__ = ['b'] > ... > >>> class Tes

Re: tuple.index()

2006-12-14 Thread Glenn Hutchings
Simon Brunning wrote: > It's because, philosophically, a Python tuple isn't just a read-only list. But there are situations where you might want to treat it as a read-only list. E.g., an argument to a function, so that you can guarantee the function won't modify it. In that case, it makes sense

Re: tuple.index()

2006-12-14 Thread Roberto Bonvallet
Glenn Hutchings wrote: > But there are situations where you might want to treat it as a > read-only list. E.g., an argument to a function, so that you can > guarantee the function won't modify it. In that case, it makes sense > for the non-modifying methods (index() and count()) to be available.

Re: Routine for prefixing '>' before every line of a string

2006-12-14 Thread Neil Cerutti
On 2006-12-14, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > Sanjay wrote: >> Is somewhere a routine useful to convert a string to lines of >> maxsize, each prefixed with a '>'. This is a typical >> requirement for 'keeping existing text while replying to a >> post in a forum'. > > Take a look to

Re: merits of Lisp vs Python

2006-12-14 Thread Bruno Desthuilliers
André Thieme a écrit : > Bruno Desthuilliers schrieb: > (snip) >> Both are highly dynamic. Neither are declarative. > > > Well, Lisp does support some declarative features in the ansi standard. If you go that way, there are declarative stuff in Python too... But neither Lisp nor Python are clo

Re: tuple.index()

2006-12-14 Thread Fredrik Lundh
Glenn Hutchings wrote: > But there are situations where you might want to treat it as a > read-only list. E.g., an argument to a function, so that you can > guarantee the function won't modify it. if you cannot trust your own code not to modify objects you pass to it, I'm not sure Python's the r

Re: How do I edit a PythonWin path to import custom built modules???

2006-12-14 Thread BartlebyScrivener
Fredrik Lundh wrote: > > have you searched the *entire* registry for the "PythonCore" key? > (python looks under HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER) > I found it in the Scripts key! I was searching on PythonPath before. Sorry. Thank you for the enlightenment. rd -- http://mail.python.org/

Re: tuple.index()

2006-12-14 Thread Glenn Hutchings
Roberto Bonvallet wrote: > list(my_arg).index(...) Absolutely -- you can work around the limitation without any problems. But the question is, why doesn't the list type share all its non-modifying methods with the tuple type? All the previous arguments about "homogenous" and "heterogenous" in thi

Re: merits of Lisp vs Python

2006-12-14 Thread Fredrik Lundh
Neil Cerutti wrote: > Please don't assume I speak for all Python programmers. They > might be rolling there eyes at me just as much as you are. ;-) we do, but that's only because you keep on arguing with cross-posting Lisp programmers. -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-14 Thread Glenn Hutchings
Fredrik Lundh wrote: > if you cannot trust your own code not to modify objects you pass to it, > I'm not sure Python's the right language for you. It's not my own code I'm worried about. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 06:03:07 -0800, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > All the previous arguments > about "homogenous" and "heterogenous" in this thread sound bogus to me. > Python is first and foremost a practical language; what lists and > tuples are supposedly "for" strikes me as being irre

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 12/14/06, Simon Brunning <[EMAIL PROTECTED]> wrote: > Tell that to Guido. They are his arguments. On 2nd thoughts, don't. He has enough on his plate at the moment. ;-) -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/py

Re: Multiple inheritance and __slots__

2006-12-14 Thread [EMAIL PROTECTED]
Simon Brunning wrote: > On 14 Dec 2006 05:23:33 -0800, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > Hi all, > > >From the google search, it seems its not possible to do the following. > > > > >>> class Test1(object): > > ... __slots__ = ['a'] > > ... > > >>> class Test2(object): > > ...

Re: merits of Lisp vs Python

2006-12-14 Thread Ken Tilton
Paul Rubin wrote: > Ken Tilton <[EMAIL PROTECTED]> writes: > >>Again, that is precisely the point of macrology (in cases like >>this). When a pattern will repeat a sufficient number of times, and a >>function cannot handle the job, > > > But this is not a case where a function can't handle the

Re: tuple.index()

2006-12-14 Thread Fredrik Lundh
Glenn Hutchings wrote: > Python is first and foremost a practical language; what lists and > tuples are supposedly "for" strikes me as being irrelevant. if you don't want to understand the design, nobody can force you. but arguing that the people behind the design "don't get it" isn't very pract

Re: tuple.index()

2006-12-14 Thread Simon Brunning
On 14 Dec 2006 06:05:12 -0800, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > It's not my own code I'm worried about. :-) If you want a language that protects you not only from your own mistakes, but also the mistakes of others, well, err, sorry, I'm not sure I can help you. Eiffel, perhaps?

Re: Logging module: problem with some mapping keys

2006-12-14 Thread Tekkaman
sim.sim wrote: > Hi, i've check documentation, and found that logging.basicConfig takes > no arguments (probably we have different versions of logging package), Your Python version is < 2.4. Now basicConfig takes optional keyword args: basicConfig([**kwargs]) Does basic configuration for the log

Re: tuple.index()

2006-12-14 Thread Glenn Hutchings
Fredrik Lundh wrote: > if you don't want to understand the design, nobody can force you. but arguing > that the people behind the design "don't get it" isn't very practical. I'm not arguing that at all. What I'm saying is that from the perspective of someone not interested in design issues, it s

  1   2   3   >