Re: Why are tuples immutable?

2004-12-31 Thread Antoon Pardon
On 2004-12-29, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> Op 2004-12-23, Scott David Daniels schreef <[EMAIL PROTECTED]>: >>>This is half the problem. In the period where an element is in the >>>wrong hash bucket, a new entry for the same value can be created in >>>th

Re: The Industry choice

2004-12-31 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > Well, Google's market capitalization must be around 50 billion dollars > or more, in the range of the top-100 companies, I believe, and they've > never kept their Python use a secret. They use Python for a lot of internal tools but their high-volume se

RE: The Industry choice

2004-12-31 Thread Walter S. Leipold
Paul Rubin writes: > I don't know that C# is really that much different from Python. > I haven't used it but I have the impression that it's sort of similar > under the skin. Nope nope nope. C# is a statically typed, statically compiled (i.e., no eval(...) or exec(...)), single-inheritance lan

Re: OT: novice regular expression question

2004-12-31 Thread It's me
Oops! Sorry, didn't realize that. Thanks, "M.E.Farmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > It's me wrote: > > The shlex.py needs quite a number of .py files. I tried to hunt down > a few > > of them and got really tire. > > > > Is there one batch of .py files that I

Re: The Industry choice

2004-12-31 Thread Alex Martelli
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > Well, Google's market capitalization must be around 50 billion dollars > > or more, in the range of the top-100 companies, I believe, and they've > > never kept their Python use a secret. > > They use P

Re: what would you like to see in a 2nd edition Nutshell?

2004-12-31 Thread JanC
JoeG schreef: > I disagree with your Tkinter vs. wxPython > decision. I tried a number of programs written with Tkinter and really > didn't like the interface. The program I helped develop is Windows > based and I knew that a program with the Tkinter interface would never > work as a cross platf

Using Tix and Tkinter

2004-12-31 Thread Harlin Seritt
I am trying to create a simple window using the following code: --code--- import Tix from Tkconstants import * from Tkinter import * root = Tix.Tk() Label(root, text="Hello!").pack() Tix.tixControl().pack() root.mainloop() ---code--- When I run this, I get the following error: Traceback (mo

Re: More baby squeaking - iterators in a class

2004-12-31 Thread Terry Reedy
"Bulba!" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks to everyone for their responses, but it still doesn't work re > returning next() method: > class R3: >def __init__(self, d): >self.d=d >self.i=len(d) >def __iter__(self): >d,i = self

Re: what is lambda used for in real code?

2004-12-31 Thread Steven Bethard
Alex Martelli wrote: Steven Bethard <[EMAIL PROTECTED]> wrote: (2) lambda a: a.lower() My first thought here was to use str.lower instead of the lambda, but of course that doesn't work if 'a' is a unicode object: Right, but string.lower works (after an 'import string'). More generally, maybe it w

Re: Parsing a search string

2004-12-31 Thread Reinhold Birkenfeld
M.E.Farmer wrote: > As I noted before shlex requires a file like object or a open file . > py> import shlex > py> a = shlex.shlex('fgfgfg dgfgfdgfdg') > py> a.get_token() > Traceback (most recent call last): > File "", line 1, in ? > File ".\shlex.py", line 74, in get_token > raw = self.read_token(

Re: More baby squeaking - iterators in a class

2004-12-31 Thread Steven Bethard
Bulba! wrote: Thanks to everyone for their responses, but it still doesn't work re returning next() method: class R3: def __init__(self, d): self.d=d self.i=len(d) def __iter__(self): d,i = self.d, self.i while i>0: i-=1 yield d[i]

Re: Parsing a search string

2004-12-31 Thread It's me
I am right in the middle of doing text parsing so I used your example as a mental exercise. :-) Here's a NDFA for your text: b 0 1-9 a-Z , . + - ' " \n S0: S0 E E S1 E E E S3 E S2 E S1: T1 E E S1 E E E E E E T1 S2: S2 E E S2 E E E E E T2 E S3: T3 E E S3 E E

Re: More baby squeaking - iterators in a class

2004-12-31 Thread M.E.Farmer
Terry Reedy wrote: >This is the wrong test for what I and some others thought you were asking. >The requirement for p to be an *iterable* and useable in code such as 'for >i in p' is that iter(p), not p itself, have a .next method, and iter(p) >will. Try ip=iter(p) followed by ip.next and ip.next()

Re: The Industry choice

2004-12-31 Thread beliavsky
Bulba wrote: >OK, so what projects and why would you consider >Python: >1. "clearly unsuitable" Large-scale scientific computing projects, such as numerical weather prediction, where performance is critical. Python could be used as the "glue" but not the "guts", where Fortran 95 and C++ are more a

Re: what is lambda used for in real code?

2004-12-31 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > >>(3) self.plural = lambda n: int(n != 1) > >>Note that this is *almost* writable with def syntax. If only we could do: > >> def self.plural(n): > >> int(n != 1) > > > > Not sure about the context, but maybe we could use, at class-level: >

Re: Parsing a search string

2004-12-31 Thread M.E.Farmer
Ah! that is what the __future__ brings I guess. Damn that progress making me outdated ;) Python 2.2.3 ( a lot of extensions I use are stuck there , so I still use it) M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-31 Thread JanC
Gerhard Haering schreef: > I can understand your emotions here. OTOH it's typical for Germans > (and even more so French) to assume that everybody speaks their > language. The same is true for English language speakers in my experience... (E.g.: why is this international newsgroup in English only

Re: Speed ain't bad

2004-12-31 Thread Bulba!
On 31 Dec 2004 06:05:44 -0800, Paul Rubin wrote: >> (initially, that was just a shell script, but whitespaces and >> strange chars that users love to enter into filenames break >> just too many shell tools) >I didn't look at your script, but why not just use info-zip?

Re: what is lambda used for in real code?

2004-12-31 Thread Steven Bethard
Alex Martelli wrote: Steven Bethard <[EMAIL PROTECTED]> wrote: py> class C(object): ... def __init__(self): ... self.plural = lambda n: int(n != 1) ... py> c = C() py> c.__class__.plural(1) Traceback (most recent call last): File "", line 1, in ? AttributeError: type object 'C' has no

Re: More baby squeaking - iterators in a class

2004-12-31 Thread Bulba!
On Fri, 31 Dec 2004 16:31:45 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: >py> p = R3('eggs') >py> i = p.__iter__() >py> i.next() >'s' >or >py> p = R3('eggs') >py> i = iter(p) >py> i.next() >'s' And that is precisely what I needed to know. Thanks, to you, Terry and everyone who took time to l

Re: The Industry choice

2004-12-31 Thread JanC
Paul Rubin schreef: > Java code is larger and takes longer to write, but has a higher chance > of working properly once it compiles and passes basic tests. That's why you can make most JSP sites useless by disabling cookies in your browser? :-p -- JanC "Be strict when sending and tolerant

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Alex Martelli
Paul L. Du Bois <[EMAIL PROTECTED]> wrote: ... > are all unsupported. I'm sorry if google groups eats my leading > whitespace; I've one-lined things to reduce the effect. It does/did, so let me repost while fixing it since this is truly, deliciously evil: > def fn(gen): > """Turns a gener

Re: The Industry choice

2004-12-31 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > array elements. Powers and subtractions in array operations seem to be > free in Fortran but very expensive in Python with Numeric. Right, particularly raising to power: a good part of your observations (not all) is accounted for by the fact that Python doesn't

Re: pyUnitPerf

2004-12-31 Thread Dieter Maurer
"Grig" <[EMAIL PROTECTED]> writes on 28 Dec 2004 18:47:45 -0800: > ... > My own experience with pyUnit has been very satisfactory and for me > personally pyUnitPerf scratches an itch. We use "pyUnit" extensively and are mostly satisfied. There is one essential problem we hit more often: setting u

Re: PyQT installation

2004-12-31 Thread Alex Martelli
Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Nanoscalesoft wrote: > > > does that mean PyQT is not forward What a bad thing is this... > > Whoa, how did you get it? > > You can buy commercial licenses and be as current as we are on Linux > with GPL versions of Qt+PyQt. Oh, and QScintilla a

Re: Parsing a search string

2004-12-31 Thread Reinhold Birkenfeld
M.E.Farmer wrote: > Ah! that is what the __future__ brings I guess. > Damn that progress making me outdated ;) > Python 2.2.3 ( a lot of extensions I use are stuck there , so I still > use it) I'm also positively surprised how many cute little additions are there every new Python version.

OT: spacing of code in Google Groups

2004-12-31 Thread beliavsky
When I copy code from a source file into a Google Groups message, the indentation is messed up, making my Python code illegal and all my code ugly. Are there tricks to avoid this? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQT installation

2004-12-31 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: > I presume the non-commercial edition is for people who want to use Qt > but don't want to pay licensing fees or open their source? Or is the GPL > version only available on non-Windows platforms? Of all the GUI > platforms I know about, Qt certainly has t

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2004-12-31 Thread Alex Martelli
Cameron Laird <[EMAIL PROTECTED]> wrote: ... > Yippee! The martellibot promises to explain Unicode for Pythoneers. > http://groups-beta.google.com/group/comp.lang.python/msg/6015a5a05c206712 Uh -- _did_ I? Eeep... I guess I did... mostly, I was pointing to Holger Krekel's very nice recipe (

Re: Mixing metaclasses and exceptions

2004-12-31 Thread Alex Martelli
Phillip J. Eby <[EMAIL PROTECTED]> wrote: > Jp Calderone wrote: > > I'd skip that, though. Your problem doesn't sound "Metaclass!" at > me. > > I wonder if you could elaborate on your usage? Perhaps there's a > better > > solution which doesn't involve metaclasses at all. > > I suspect he cou

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Steven Bethard
Alex Martelli wrote: Paul L. Du Bois <[EMAIL PROTECTED]> wrote: def fn(gen): """Turns a generator expression into a callable.""" def anonymous(*args): return gen.next() return anonymous def args(): """Works with fn(); yields args passed to anonymous().""" while True: yield sys._getfr

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Scott David Daniels
David Bolen wrote: So for example, an asynchronous sequence of operations might be like: d = some_deferred_function() d.addCallback(lambda x: next_function()) d.addCallback(lambda blah: third_function(otherargs, blah)) d.addCallback(lambda x: last_function()) which to me is more rea

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > Does that seem about right? Yep! > P.S. That's so *evilly* cool! We should have an Evilly Cool Hack of the Year, and I nominate Paul du Bois's one as the winner for 2004. Do I hear any second...? Alex -- http://mail.python.org/mailman/listinfo/py

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > We should have an Evilly Cool Hack of the Year, and I nominate Paul du > Bois's one as the winner for 2004. Do I hear any second...? The year's not over yet :). -- http://mail.python.org/mailman/listinfo/python-list

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Ian Bicking
David Bolen wrote: Ian Bicking <[EMAIL PROTECTED]> writes: The one motivation I can see for function expressions is callback-oriented programming, like: get_web_page(url, when_retrieved={page | give_page_to_other_object(munge_page(page))}) This is my primary use case for lambda's nowa

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-31 Thread Brian van den Broek
Hi all, a question about using parenthesis for tuples veered very far off topic before I returned from a trip and found the thread. I've a comment on the original topic, and then a comment off-topic even for the off-topic direction in which the thread ended up :-) The on-topic: the use of '(' a

Re: Parsing a search string

2004-12-31 Thread Andrew Dalke
"It's me" wrote: > Here's a NDFA for your text: > >b 0 1-9 a-Z , . + - ' " \n > S0: S0 E E S1 E E E S3 E S2 E > S1: T1 E E S1 E E E E E E T1 > S2: S2 E E S2 E E E E E T2 E > S3: T3 E E S3 E E E E E E T3 Now if I only had an NDFA for parsing that syntax...

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread David Bolen
Scott David Daniels <[EMAIL PROTECTED]> writes: > David Bolen wrote: > > So for example, an asynchronous sequence of operations might be like: > > d = some_deferred_function() > > d.addCallback(lambda x: next_function()) > > d.addCallback(lambda blah: third_function(otherargs, blah)) >

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Scott David Daniels
David Bolen wrote: Scott David Daniels <[EMAIL PROTECTED]> writes: while test() != False: ...code... I'm not sure I follow the "error" in this snippet... The code is "fat" -- clearer is: while test(): ...code... The right sequence using lambda is: d = some_deferred_

Re: Parsing a search string

2004-12-31 Thread It's me
"Andrew Dalke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "It's me" wrote: > > Here's a NDFA for your text: > > > >b 0 1-9 a-Z , . + - ' " \n > > S0: S0 E E S1 E E E S3 E S2 E > > S1: T1 E E S1 E E E E E E T1 > > S2: S2 E E S2 E E E E E T2 E > >

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-31 Thread Alex Martelli
Brian van den Broek <[EMAIL PROTECTED]> wrote: ... > > Have you heard of Villanova, often named as the birthplace of Italian > > civilization? That's about 15 km away, where I generally go for major > > grocery shopping at a hypermarket when I _do_ have a car. > > > > > Alex > > 'Hypermarke

Re: Parsing a search string

2004-12-31 Thread Brian Beck
Freddie wrote: I'm trying to parse a search string so I can use it for SQL WHERE constraints, preferably without horrifying regular expressions. Uhh yeah. If you're interested, I've written a function that parses query strings using a customizable version of Google's search syntax. Features incl

Re: Parsing a search string

2004-12-31 Thread John Machin
Andrew Dalke wrote: > "It's me" wrote: > > Here's a NDFA for your text: > > > >b 0 1-9 a-Z , . + - ' " \n > > S0: S0 E E S1 E E E S3 E S2 E > > S1: T1 E E S1 E E E E E E T1 > > S2: S2 E E S2 E E E E E T2 E > > S3: T3 E E S3 E E E E E E T3 > > Now if I only h

Re: The Industry choice

2004-12-31 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Peter Dembinski <[EMAIL PROTECTED]> writes: >> If it has to be both reliable and secure, I suggest you used more >> redundant language such as Ada 95. > >That's something to think about and it's come up in discussions, b

Re: The Industry choice

2004-12-31 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Christopher Koppler <[EMAIL PROTECTED]> wrote: . . . >Manager culture is still very much mired in rituals that may in one form >or another go back to hunter-gatherer days (or maybe even further)

Re : Upgrade woes: Numeric, gnuplot, and Python 2.4

2004-12-31 Thread Cedric
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive ([EMAIL PROTECTED]) Subject: Upgrade woes: Numeric, gnuplot, and Python 2.4 Date: 2004-12-11 18:45:10 PST > Here's my sitch: > > I use gnuplot.py a

Re: pyUnitPerf

2004-12-31 Thread Peter Hansen
Dieter Maurer wrote: We use "pyUnit" extensively and are mostly satisfied. There is one essential problem we hit more often: setting up and tearing down can take excessive time. Often, we are forced to abandon the test independence and let a complete set of tests share the main part of the fixture.

Re: OT: spacing of code in Google Groups

2004-12-31 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > When I copy code from a source file into a Google Groups message, the > indentation is messed up, making my Python code illegal and all my code > ugly. Are there tricks to avoid this? Try putting a # at the start of every line. Everyone should understand what you mean (a

Re: The Industry choice

2004-12-31 Thread Hans Nowak
Paul Rubin wrote: You should write unit tests either way, but in Python you're relying on the tests to find stuff that the compiler finds for you with Java. As I wrote on my weblog a while ago, I suspect that this effect is largely psychological. You jump through hoops, declaring types all over

Re: The Industry choice

2004-12-31 Thread Hans Nowak
Christopher Koppler wrote: > -- > Christopher > > In theory, I'm in love with Lisp, > but I hop into bed with Python every chance I get. That reminds me of something my old math teacher used to say... "My wife is my cathedral, but I pray in every chapel." :-) -- Hans Nowak http://zephyrfalcon.org

Re: OT: spacing of code in Google Groups

2004-12-31 Thread Grant Edwards
On 2004-12-31, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> When I copy code from a source file into a Google Groups >> message, the indentation is messed up, making my Python code >> illegal and all my code ugly. Are there tricks to avoid this? > > Try putting a # at

Re: OT: spacing of code in Google Groups

2004-12-31 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > When I copy code from a source file into a Google Groups message, the > > indentation is messed up, making my Python code illegal and all my > code > > ugly. Are there tricks to avoid this? > > Try putting a # at the start of every line. Ever

Of closures and expressing anonymous functions [Was: Re: Securing a future for anonymous functions in Python]

2004-12-31 Thread Simo Melenius
[EMAIL PROTECTED] (Bengt Richter) writes: > Closure is the name for the whole thing, apparently, not just the > environment the procedure body needs, which was the aspect that I > (mis)attached the name to. Which brings me to the point where I'd welcome more flexibility in writing to variables ou

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Paul Du Bois
Alex Martelli wrote: > We should have an Evilly Cool Hack of the Year, and I nominate Paul du > Bois's one as the winner for 2004. Do I hear any second...? Thank you :-) I am busy writing it up as a recipe. I think I have a pleasing way for it to be portable, even. Unfortunately, that removes

Re: OT: spacing of code in Google Groups

2004-12-31 Thread [EMAIL PROTECTED]
Grant Edwards wrote: > On 2004-12-31, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > >> When I copy code from a source file into a Google Groups > >> message, the indentation is messed up, making my Python code > >> illegal and all my code ugly. Are there tricks to avo

Re: Parsing a search string

2004-12-31 Thread It's me
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Andrew Dalke wrote: > > "It's me" wrote: > > > Here's a NDFA for your text: > > > > > >b 0 1-9 a-Z , . + - ' " \n > > > S0: S0 E E S1 E E E S3 E S2 E > > > S1: T1 E E S1 E E E E E E T1 > > > S2:

Re: what would you like to see in a 2nd edition Nutshell?

2004-12-31 Thread Jay Parlar
Jumping in a bit late here, but I'd personally REALLY like to see something about PEP 246, and more specifically, what Phillip Eby has done about it with the PyProtocols package. Especially with all this static typing talk going on these days, a good set of documentation (with lots of useful ex

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-31 Thread Scott David Daniels
Roel Schroeven wrote: Rocco Moretti wrote: So to summarize: Commas define tuples, except when they don't, and parentheses are only required when they are necessary. I hope that clears up any confusion. You have my vote for QOTW. +1 as well By the way, since we seem to be commenting on sigs in this

Re: PyQT installation

2004-12-31 Thread Brian
For those curious about Trolltech's stance on Windows, here's what Trolltech's "License FAQ - Open Source Edition" ( http://www.trolltech.com/developer/faqs/license_gpl.html ) has to say: " Why is there no Open Source (GNU GPL) version of Qt on Windows ? We have regrettably not found a way of mak

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Simo Melenius
Ian Bicking <[EMAIL PROTECTED]> writes: > But I do think there's other ways to approach this. Function > expressions could get really out of hand, IMHO, and could easily lead > to twenty-line "expressions". That's aesthetically incompatible with > Python source, IMHO. You can already write unae

Re: The Industry choice

2004-12-31 Thread Steve Holden
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, Christopher Koppler <[EMAIL PROTECTED]> wrote: . . . Manager culture is still very much mired in rituals that may in one form or another go back to hunter-gatherer days (or

PyCon submission about to close

2004-12-31 Thread Steve Holden
Just a quick reminder for the laggards among us that you now have approximately SEVEN HOURS in which to submit your proposals for a talk at PyCon. Thanks to all who have already taken the trouble to do so, and to the rest of you: GET ON WITH IT! happy-new-year-ly y'rs - steve -- Steve Holden

Re: what is lambda used for in real code?

2004-12-31 Thread Adam DePrince
On Fri, 2004-12-31 at 01:53, Steven Bethard wrote: > I thought it might be useful to put the recent lambda threads into > perspective a bit. I was wondering what lambda gets used for in "real" > code, so I grepped my Python Lib directory. Here are some of the ones I > looked, classified by how

Quoting code [was: OT: spacing of code in Google Groups]

2004-12-31 Thread Steve Holden
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: When I copy code from a source file into a Google Groups message, the indentation is messed up, making my Python code illegal and all my code ugly. Are there tricks to avoid this? Try putting a # at the start of every line.

Re: OT: spacing of code in Google Groups

2004-12-31 Thread Adam DePrince
On Fri, 2004-12-31 at 13:03, [EMAIL PROTECTED] wrote: > When I copy code from a source file into a Google Groups message, the > indentation is messed up, making my Python code illegal and all my code > ugly. Are there tricks to avoid this? Subscribe to the python-list@python.org mailing list. Tak

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Steven Bethard
Simo Melenius wrote: map (def x: if foo (x): return baz_1 (x) elif bar (x): return baz_2 (x) else: global hab hab.append (x) return baz_3 (hab), [1,2,3,4,5,6]) I think this would probably have to be wri

Re: The Industry choice

2004-12-31 Thread Mike Meyer
[EMAIL PROTECTED] (Cameron Laird) writes: > For a not-too-different variety of safety, I like Eiffel. Again, > Eiffel compilers are available nearly, but not entirely, everywhere. Eiffel compilers tend to generate C code, and hence work on anything with a C compiler. The question then becomes ho

Re: what is lambda used for in real code?

2004-12-31 Thread Steven Bethard
Adam DePrince wrote: Lets not forget the "real reason" for lambda ... the elegance of orthogonality. Why treat functions differently than any other object? We can operate on every other class without having to involve the namespace, why should functions be any different? Yup. I think in most o

Re: what is lambda used for in real code?

2004-12-31 Thread Hans Nowak
Adam DePrince wrote: In sort, we must preserve the ability to create an anonymous function simply because we can do so for every other object type, and functions are not special enough to permit this special case. Your reasoning makes sense... lambda enables you to create a function as part of an

Zope newsgroups? Need help with POSKeyError

2004-12-31 Thread Bob Horvath
I have a Zope/Plone combination that I have been having POSKeyErrors with for a while now. Are there any newsgroups that deal with Zope? -- http://mail.python.org/mailman/listinfo/python-list

Re: what is lambda used for in real code?

2004-12-31 Thread Steven Bethard
Hans Nowak wrote: Adam DePrince wrote: In sort, we must preserve the ability to create an anonymous function simply because we can do so for every other object type, and functions are not special enough to permit this special case. Your reasoning makes sense... lambda enables you to create a funct

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Simo Melenius
Steven Bethard <[EMAIL PROTECTED]> writes: > Simo Melenius wrote: > > map (def x: > > if foo (x): > > return baz_1 (x) > > elif bar (x): > > return baz_2 (x) > > else: > > global hab > > hab.append (x) > >

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Doug Holton
Steven Bethard wrote: Simo Melenius wrote: map (def x: if foo (x): return baz_1 (x) elif bar (x): return baz_2 (x) else: global hab hab.append (x) return baz_3 (hab), [1,2,3,4,5,6]) I think this would

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Paul L. Du Bois
Alex Martelli wrote: > We should have an Evilly Cool Hack of the Year, and I nominate > Paul Du Bois's one as the winner for 2004. Do I hear any second...? Oh bother, I just realized I sent my first reply using a good email address. Hope that cancel goes through quickly. Anyway, thank you! I'v

Re: Zope newsgroups? Need help with POSKeyError

2004-12-31 Thread richard
Bob Horvath wrote: > I have a Zope/Plone combination that I have been having POSKeyErrors > with for a while now. Are there any newsgroups that deal with Zope? No, but there is a mailing list - see zope.org Also, try google searching for POSKeyError. Richard -- http://mail.python.org/mai

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Steven Bethard
Paul Rubin wrote: [EMAIL PROTECTED] (Alex Martelli) writes: We should have an Evilly Cool Hack of the Year, and I nominate Paul du Bois's one as the winner for 2004. Do I hear any second...? The year's not over yet :). Ok, now that we're past 0:00:00 UTC, I'll second that nomination! ;) Steve P.S.

Re: what is lambda used for in real code?

2004-12-31 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: ... > > Your reasoning makes sense... lambda enables you to create a function as > > part of an expression, just like other types can be part of an > > expression. However, by that same reasoning, maybe classes aren't > > special enough either to warr

Re: what is lambda used for in real code?

2004-12-31 Thread Reinhold Birkenfeld
Adam DePrince wrote: >> So, those are my thoughts on how lambdas are "really" used. If others >> out there have real-life code that uses lambdas in interesting ways, >> feel free to share them here! >> > > Lets not forget the "real reason" for lambda ... I really hoped you would point out th

exposing C array to python namespace: NumPy and array module.

2004-12-31 Thread Bo Peng
Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res = PyArray_FromDimsAndData(1, int*dim, PyArray_DOUBLE, char*buf); Users will get a Numeric Array object and can change it

Re: OT: spacing of code in Google Groups

2004-12-31 Thread Peter Hansen
Grant Edwards wrote: I always rather liked line numbers (a-la 'can -n'). That also makes discussion of the code easier: That, unfortunately, is somewhat harder to remove without using a regular expression... leading hash marks # is pretty simple to remove with almost any editor. -Peter -- http://

Re: Parsing a search string

2004-12-31 Thread Freddie
Reinhold Birkenfeld wrote: Freddie wrote: Happy new year! Since I have run out of alcohol, I'll ask a question that I haven't really worked out an answer for yet. Is there an elegant way to turn something like: > moo cow "farmer john" -zug into: ['moo', 'cow', 'farmer john'], ['zug'] I'm trying

Re: Parsing a search string

2004-12-31 Thread M.E.Farmer
py>b = shlex.shlex(a) py>while 1: ... tok = b.get_token() ... if not tok: break ... print tok ... moo cow + "farmer john" - dog Just wanted to share this just in case it might be relevant . It seems if we don't add +- to wordchars then we get a different split on "farmer john". M.E.Fa

Re: pygame + py2exe = bad exe. why?

2004-12-31 Thread Erik Bethke
M.E.Farmer wrote: > Hello Erik, > Have you ever seen pygame2exe.py? > It is a py2exe script for pygame. Hello M.E. Farmer, Thank you for your response. I looked into it and I discovered this speedbump: http://aspn.activestate.com/ASPN/Mail/Message/pygame-users/2244073 "pygame-users Re: [pygame

Re: More baby squeaking - iterators in a class

2004-12-31 Thread Terry Reedy
"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >>will. Try ip=iter(p) followed by ip.next and ip.next() instead. > Does that mean if you dont't call iter(() on your instance or have a > next() method you can't do this: > p=R3('eggs') > for

Re: Securing a future for anonymous functions in Python

2004-12-31 Thread Bengt Richter
On 01 Jan 2005 00:56:30 +0200, Simo Melenius <[EMAIL PROTECTED]> wrote: >Steven Bethard <[EMAIL PROTECTED]> writes: > >> Simo Melenius wrote: >> > map (def x: >> > if foo (x): >> > return baz_1 (x) >> > elif bar (x): >> > return baz_2 (x) >> > e

Re: More baby squeaking - iterators in a class

2004-12-31 Thread M.E.Farmer
Terry , Thank you for the explanation . That is much clearer now, I have played a bit with generators but have never tried to create a custom iterator. I am just now getting into the internals part of python objects... this langauage is still amazing to me! The reason I asked the question was becau

Re: pygame + py2exe = bad exe. why?

2004-12-31 Thread M.E.Farmer
Erik Bethke wrote: > > # setup.py > > from distutils.core import setup > > import py2exe > > > > setup(console=["myscript.py"]) > > > > # > > python setup.py py2exe > > > > -Knio Erik glad to see you were able to track it down. Have you been succesful in making the changes they mentioned?

Re: what is lambda used for in real code?

2004-12-31 Thread Terry Reedy
"Adam DePrince" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In sort, we must preserve the ability to create an anonymous function > simply because we can do so for every other object type, and functions > are not special enough to permit this special case. Please show me how to

Re: what is lambda used for in real code?

2004-12-31 Thread Jp Calderone
On Fri, 31 Dec 2004 22:09:49 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Adam DePrince" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > In sort, we must preserve the ability to create an anonymous function > > simply because we can do so for every other object type, and fu

Re: OT: spacing of code in Google Groups

2004-12-31 Thread M.E.Farmer
Grant Edwards wrote: >Not sure what Google Groups does to it... The usual... it mangles it. I don't get it, Google uses Python too, they know it is whitespace signifigant. I made a complaint several weeks ago to Google support , asking them too quit stripping leading whitespace, and the sent me a r

Re: The Industry choice

2004-12-31 Thread Paul Rubin
Christopher Koppler <[EMAIL PROTECTED]> writes: > >> 2. "plausible but there are sound technical reasons to be wary" > > > > A security-critical financial application. > > Why, specifically? Would you need to eval user input? Static typing, checked exceptions, etc. > > I haven't used those eith

Re: Of closures and expressing anonymous functions [Was: Re: Securing a future for anonymous functions in Python]

2004-12-31 Thread Terry Reedy
"Simo Melenius" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] (Bengt Richter) writes: > Which brings me to the point where I'd welcome more flexibility in > writing to variables outside the local scope. This idea was discussed extensively on PyDev perhaps 2 year

Any Python XML Data Binding Utilities Avaiable?

2004-12-31 Thread SeSe
Hi, every one, happy new year! I am working on XML with Python. I wonder if there is any XML Schema<-> Python Object mapping tools so that we can convert one to another. Thanks. -SeSe -- http://mail.python.org/mailman/listinfo/python-list

Re: The Industry choice

2004-12-31 Thread JanC
Steve Holden schreef: > Would anyone undertake to give a "Hidden Technologies" talk at PyCon, > outlining how this phenomenon operates against the adoption of > technologies that the big boys effectively keep to themselves by > keeping quiet about? Google's use of Python , while not a closely-ke

Re: The Industry choice

2004-12-31 Thread M.E.Farmer
No one pointed these out so here goes: Python's list http://www.python.org/Quotes.html Disney animation http://python.oreilly.com/news/disney_0201.html Disney Panda3d http://www.python.org/pycon/dc2004/papers/29/ There are several other companies using Python for game logic and scripting, I am dra

Re: OT: spacing of code in Google Groups

2004-12-31 Thread JanC
Adam DePrince schreef: > On Fri, 2004-12-31 at 13:03, [EMAIL PROTECTED] wrote: >> When I copy code from a source file into a Google Groups message, the >> indentation is messed up, making my Python code illegal and all my code >> ugly. Are there tricks to avoid this? > > Subscribe to the python-l

Lambda as declarative idiom (was RE: what is lambda used for in real code?)

2004-12-31 Thread Robert Brewer
Steven Bethard wrote: > * Rewritable with existing functions > Mainly these are examples of code that can benefit from using the > functions available in the operator module, especially > operator.itemgetter and operator.attrgetter (available in 2.4) > ... > * Rewritable with list comprehensions/g

Weekly Python Patch/Bug Summary

2004-12-31 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 261 open ( +4) / 2718 closed ( +3) / 2979 total ( +7) Bugs: 801 open ( -6) / 4733 closed (+16) / 5534 total (+10) RFE : 165 open ( +2) / 139 closed ( +0) / 304 total ( +2) New / Reopened Patches __ Patch for

Re: OT: spacing of code in Google Groups

2004-12-31 Thread Dan Bishop
M.E.Farmer wrote: > Grant Edwards wrote: > >Not sure what Google Groups does to it... > The usual... it mangles it. > I don't get it, Google uses Python too, they know it is whitespace > signifigant. And for a long time, Google groups postings *were* whitespace significant. But the new interface

Re: what is lambda used for in real code?

2004-12-31 Thread Aahz
In article <[EMAIL PROTECTED]>, Adam DePrince <[EMAIL PROTECTED]> wrote: > >Unless internationalization was a concern, few people would write: > >THE_ANSWER_IS = "The answer is" >print THE_ANSWER_IS, x However, there's a moderately large (and growing!) set of people who would argue that I18N is *

  1   2   >