Re: Socket Speed

2005-06-05 Thread marinus van aswegen
Would you care to do that between two machines on a 100mb link ? On 6/5/05, Jeff Epler <[EMAIL PROTECTED]> wrote: > 300KB/s sounds dreadfully low. > > I simply ran "python /usr/lib/python2.3/SimpleHTTPServer.py &", then > "wget -O /dev/null http://0.0.0.0:8000/70megfile";. On the best of 4 > run

Re: Socket Speed

2005-06-05 Thread marinus van aswegen
Hi Jeff Would you care to do that between two machines on a 100mb link ? M On 6/5/05, Jeff Epler <[EMAIL PROTECTED]> wrote: > 300KB/s sounds dreadfully low. > > I simply ran "python /usr/lib/python2.3/SimpleHTTPServer.py &", then > "wget -O /dev/null http://0.0.0.0:8000/70megfile";. On the bes

easiest way to split a list into evenly divisble smaller lists, and assign them to variables?

2005-06-05 Thread flamesrock
Lets say I have a list containing 12, 13, 23 or however many entries. What I want is the greatest number of lists evenly divisible by a certain number, and for those lists to be assigned to variables. This leads to a few problems.. If I don't know the length of the list beforehand, I can't create

Re: urllib2 pinger : insight as to use, cause of hang-up?

2005-06-05 Thread EP
"Mahesh" advised: > > Timing it out will probably solve it. > Thanks. Follow-on question regarding implementing a timeout for use by urllib2. I am guessing the simplest way to do this is via socket.setdefaulttimeout(), but I am not sure if this sets a global parameter, and if so, whether it

Re:

2005-06-05 Thread Jatinder Singh
I am reading a only. But what if I want read write and execute that file. -- Regards, Jatinder Singh “ Everyone needs to be loved... especially when they do not deserve it.” XX Quoting Tiago Stürmer Daitx <[EMAIL PRO

Re: Building Python with gdbm support

2005-06-05 Thread Ed
I've actually sorted myself out. I updated Modules/Setup.dist, so that it has the following line... gdbm gdbmmodule.c -I/ct/ctapp/gnu/bin/gdbm-1.8.3/include -L/ct/ctapp/gnu/bin/gdbm-1.8.3/lib -lgdbm Rebuilt everything in Python. I also had to ensure that my environment using the newly-built Pyt

Re: Tkinter: How can I update an image display?

2005-06-05 Thread Terry Carroll
On 05 Jun 2005 21:04:40 -0700, Paul Rubin wrote: >Try using root.update()? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Building Python with gdbm support

2005-06-05 Thread Ed
I am trying to use a Perl script which requires a Database module other than "dbm" to be the default Mod. So, what the script is checking is import anydbm if (anydbm._defaultmod.__name__ == 'dumbdbm' or anydbm._defaultmod.__name__ == 'dbm'): First of, I'm doing this on a Sparc/Solaris 8 box.

Re: default values of function parameters

2005-06-05 Thread Terry Reedy
"David Isaac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > But the default values of function parameters seem rather like a static > attributes of a class. > Is that a good way to think of them? If you think of a function as defining a subclass of execution instances, with __in

Re: Destructive Windows Script

2005-06-05 Thread Paul Rubin
rbt <[EMAIL PROTECTED]> writes: > Thanks for the opinion... I don't do malware. Just interested in > speeding up file wiping (if possible) for old computers that will be > auctioned. The boot programs that you allude to (killdisk, autoclave) > work well, but are slow and tedious. Yes, you have to

Re: Tkinter: How can I update an image display?

2005-06-05 Thread Paul Rubin
Terry Carroll <[EMAIL PROTECTED]> writes: > I trimmed it down to a basic app indicating the problem and the code > is at the end of this message. It should display the three listed > sample images, one after another. > > The thing is, if I uncomment the raw_input call, it works. But I > don't wa

Re: Tkinter: How can I update an image display?

2005-06-05 Thread Terry Carroll
On Sun, 05 Jun 2005 20:39:04 -0700, Terry Carroll <[EMAIL PROTECTED]> wrote: >The thing is, if I uncomment the raw_input call, it works. But I >don't want to have to hit ENTER after each image. And the, just to be confusing, I posted the uncommented version. To make my example more consistent w

Tkinter: How can I update an image display?

2005-06-05 Thread Terry Carroll
I've got a small batch image-processing program (it adds the time a digital photo was taken to the lower right of the image), and as a feature, I wanted to show a thumbnail of each image it was being processed. I can't get the image to update, though. I trimmed it down to a basic app indicating t

Re: Destructive Windows Script

2005-06-05 Thread Terry Reedy
"Chris Lambacher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The reason they are slow and tedious is that they need to write to > every byte on the disk. Depending on the size of the disk, there may > be a lot of data that needs to be written, and if they are older > computers

Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements

2005-06-05 Thread Nicolas Fleury
Delaney, Timothy C (Timothy) wrote: > Nicolas Fleury wrote: >>def getFirstLine(filename): >> with opening(filename) as file >> return file.readline() > > Your tastes definitely disagree with the majority of Python programmers > then, including Guido. Scoping is defined in Python by indenta

default values of function parameters

2005-06-05 Thread David Isaac
Alan Isaac wrote: > Default parameter values are > evaluated once when the function definition is > executed. Where are they stored? ... Where is this documented? Forgive any poor phrasing: I'm not a computer science type. At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read: "The exe

Re: urllib2 pinger : insight as to use, cause of hang-up?

2005-06-05 Thread Mahesh
Timing it out will probably solve it. -- http://mail.python.org/mailman/listinfo/python-list

urllib2 pinger : insight as to use, cause of hang-up?

2005-06-05 Thread EP
Hello patient and tolerant Pythonistas, Iterating through a long list of arbitrary (and possibly syntactically flawed) urls with a urllib2 pinging function I get a hang up. No exception is raised, however (according to Windows Task Manager) python.exe stops using any CPU time, neither increasi

Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)

2005-06-05 Thread Neil Hodgson
Mike Meyer: > The obvious solution would be for the system to detect all these > environmental factors, and scale the applications > accordingly. However, things like viewing distance and the quality of > my eyesight are hard to detect automatically, and it would be a pain > to have to enter all t

Re: PyArg_ParseTuple and dict

2005-06-05 Thread Jeff Epler
I tried to recreate the problem based on what you described in your message. I was unable to recreate the problem. I wrote the following file "sjh.c": #include PyObject *f(PyObject *self, PyObject *args) { PyObject *ob = NULL; if(!PyArg_ParseTuple(args, "O", &ob)) return NULL; Py_I

Re: Iterate through a list calling functions

2005-06-05 Thread Kent Johnson
David Pratt wrote: > Hi Kent. Thank you for your reply. I gave this a go but get the > following traceback: > ... > result = validator(name, value) > TypeError: 'str' object is not callable > > Have put validators in list and iterate over it as in following: > > validator_list = > [is

Re: Iterate through a list calling functions

2005-06-05 Thread Kent Johnson
George Sakkis wrote: > That's a typical case for using an OO approach; just make a class for > each validator and have a single polymorphic validate method (I would > make validators __call__able instead of naming the method 'validate'): > > # Abstract Validator class; not strictly necessary but g

Re: PyArg_ParseTuple and dict

2005-06-05 Thread John Machin
[EMAIL PROTECTED] wrote: >>3. What is your platform? Which C compiler? What warnings does it give, >>[or would it give if allowed free speech]? Are you running Python 2.4 or >>2.4.1? > > > Python 2.4 (#1, Mar 10 2005, 16:54:23) [C] on sunos5 > > Solaris 9 x86, forte 6.2 > warnings? > > >>4

Question about Object Oriented + functions/global vars?

2005-06-05 Thread flamesrock
ok, so to my knowledge, object oriented means splitting something into the simplest number of parts and going from there. But the question is- when is it enough? For example I have the following code: #def put_file(file_id, delete=False): #""" Function to put the file on the FTP Server #

Re: Destructive Windows Script

2005-06-05 Thread Peter Hansen
rbt wrote: > Chris Lambacher wrote: > >> The reason they are slow and tedious is that they need to write to >> every byte on the disk. Depending on the size of the disk, there may >> be a lot of data that needs to be written, and if they are older >> computers, write speed may not be particularly

Re: Destructive Windows Script

2005-06-05 Thread Robert Kern
rbt wrote: > Chris Lambacher wrote: > >>The reason they are slow and tedious is that they need to write to >>every byte on the disk. Depending on the size of the disk, there may >>be a lot of data that needs to be written, and if they are older >>computers, write speed may not be particularly fas

Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)

2005-06-05 Thread Paul Rubin
Chris Lambacher <[EMAIL PROTECTED]> writes: > I think you need to step out of the age of Motif and MFCs and look at > what modern toolkits and GUI designers have to offer before you start > in on a rant. Yeah, pretty much every fancy web page designer these days uses graphic tools like Dreamweaver

Re: Destructive Windows Script

2005-06-05 Thread rbt
Chris Lambacher wrote: > The reason they are slow and tedious is that they need to write to > every byte on the disk. Depending on the size of the disk, there may > be a lot of data that needs to be written, and if they are older > computers, write speed may not be particularly fast. OK, I accept

Re: Destructive Windows Script

2005-06-05 Thread Chris Lambacher
The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. -Chris On 6/5/05, rbt <[EMAIL PROTECTED]>

Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)

2005-06-05 Thread Chris Lambacher
I think you missed looking at several GUI builders. I have not used a GUI builder in 5 years that had you nail down positions. Swing(for Java), GTK, Qt, and wxWidgets(to a lesser degree) all use a sizer metaphore. You lay out he sizers and put your widgets in various sizer layouts. This means t

Re: PyArg_ParseTuple and dict

2005-06-05 Thread [EMAIL PROTECTED]
> 1. On the surface, there appears to be a bug. In the interests of > finding out where the bug is, perhaps it would be better if you posted > your minimal compilable runnable example of what *doesn't* work. I'll post it later tonight. > 2. To get you off the ground: *if* there is only one argume

Re: Destructive Windows Script

2005-06-05 Thread rbt
Roose wrote: > My guess would be: extremely, extremely easy. Since you're only writing 30 > bytes for each file, the vast majority of the data will still be present on > disk, just temporarily inaccessible because of the del command. And more > than likely it will be possible to recover 100% i

Re: random module question

2005-06-05 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes: > Can I rely on the random.py module to produce the same series of numbers for > future/past versions of Python, given the same seed? Can I rely on it > across different architectures and operating systems? > > I looked at the docs and couldn't find this stat

Re: Destructive Windows Script

2005-06-05 Thread Roose
My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if they are using a j

Re: PyArg_ParseTuple and dict

2005-06-05 Thread John Machin
[EMAIL PROTECTED] wrote: > I'm trying to write an extension for python 2.4, and I can't seem to > get PyArg_ParseTuple to work with a dict. I've tried all sorts of > things, but the most simple thing that fails is: > > [...] > if (!PyArg_ParseTuple(args, "O", &file)) { > return NULL; >

Re: Pythonic Gotchas

2005-06-05 Thread alex23
Ivan Van Laningham wrote: > This little gotcha ought to be number one on "The Official List of > Pythonic Gotchas," which should be required reading for everyone. > > What? There isn't one? Why not? There's at least one active "Python Gotchas" page out there: http://www.ferg.org/projects/pytho

Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements

2005-06-05 Thread Paul Rubin
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> writes: > Be sure to read the referenced PEPs (and the ones referenced from them) > - they contain a lot of history. Also read PEP 346 for a competing PEP > to PEPs 340 and 343 that gradually converged to PEP 343 - most > importantly, it contains t

Re: The need to put "self" in every method

2005-06-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Aahz) (A) wrote: >> >> Any objection to swiping this for the FAQ? (Probably with some minor >> edits.) > >No. >The global/local stuff needs a bit more nuance (assignments in the method >being the crite

Destructive Windows Script

2005-06-05 Thread rbt
How easy or difficult would it be for a computer forensics expert to recover data that is overwritten in this manner? This is a bit off-topic for comp.lang.python, but I thought some here would have some insight into this. Warning: **This code is destructive**. Do not run it unless you fully u

Re: GUI builders considered harmful

2005-06-05 Thread Mike Meyer
Bruce Stephens <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: > > [...] > >> The first, and most obvious, thing that GUI builders do is force the >> developer to specify an exact position - if not size - for the >> graphical elements of the UI. > > They do? I don't remember

random module question

2005-06-05 Thread Roose
Can I rely on the random.py module to produce the same series of numbers for future/past versions of Python, given the same seed? Can I rely on it across different architectures and operating systems? I looked at the docs and couldn't find this stated anywhere. My feeling is yes, but it's a f

Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements

2005-06-05 Thread Mike Meyer
Paul Rubin writes: > "Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> writes: >> Be sure to read the referenced PEPs (and the ones referenced from them) >> - they contain a lot of history. Also read PEP 346 for a competing PEP >> to PEPs 340 and 343 that gradually conv

RE: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements

2005-06-05 Thread Delaney, Timothy C (Timothy)
Nicolas Fleury wrote: > def getFirstLine(filename): > with opening(filename) as file > return file.readline() Your tastes definitely disagree with the majority of Python programmers then, including Guido. Scoping is defined in Python by indentation. If you want the above sort of thing,

PyArg_ParseTuple and dict

2005-06-05 Thread [EMAIL PROTECTED]
I'm trying to write an extension for python 2.4, and I can't seem to get PyArg_ParseTuple to work with a dict. I've tried all sorts of things, but the most simple thing that fails is: [...] if (!PyArg_ParseTuple(args, "O", &file)) { return NULL; } [...] If I call the function from

Re: What are OOP's Jargons and Complexities?

2005-06-05 Thread Andrea Griffini
On Sun, 05 Jun 2005 16:30:18 +0200, Matthias Buelow <[EMAIL PROTECTED]> wrote: >Quite embarrassing, but it's a runtime bug and got nothing to do with >the language per se. And it certainly manifests itself after the >hey-days of Turbo Pascal (when Borland seems to have lost interest in >maintaini

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-05 Thread Steven Bethard
Nicolas Fleury wrote: > Since the current syntax would be there, the no-indentation syntax can > be explained in terms of the indentation syntax: > > """ > To avoid over-indentation, a with-statement can avoid defining a new > indentation block. In that case, the end of the with block is the en

Re: "Opposite" of splitting?

2005-06-05 Thread Paul Rubin
Jan Danielsson <[EMAIL PROTECTED]> writes: > I have a list of integers: > q = [ 1, 2, 4, 7, 9 ] > which I would like to convert to a string: > "1,2,4,7,9" s = ','.join([str(n) for n in q]) Alternatively, just repr(q) gives you '[1, 2, 4, 7, 9]' (with the brackets and spaces). -- http://mail.pyth

"Opposite" of splitting?

2005-06-05 Thread Jan Danielsson
Hello all, I have a list of integers: q = [ 1, 2, 4, 7, 9 ] which I would like to convert to a string: "1,2,4,7,9" This is *very* easy to do with a simple while loop.. But I suspect that there is a more elegant way to do it in Python. Is there? If so: How? -- http://mail.python.org/mailman

Re: error in usin list with boost

2005-06-05 Thread Neil Hodgson
GujuBoy: > i have created a "cpp" file which has the followin code and when i try > to compile it..it does not know what "list" is..it says its > undefined..i also tried using #include I would have expected this (except the cstdint.h line which may not be needed but it was in the code I cop

Re: mix up a string

2005-06-05 Thread rbt
Reinhold Birkenfeld wrote: > rbt wrote: > >>What's the best way to take a string such as 'dog' and mix it up? You >>know, like the word jumble in the papers? ODG. I thought something like >>mix = random.shuffle('dog') would do it, but it won't. Any tips? > > > py> def shuffled(s): > ... l

Re: mix up a string

2005-06-05 Thread Reinhold Birkenfeld
rbt wrote: > What's the best way to take a string such as 'dog' and mix it up? You > know, like the word jumble in the papers? ODG. I thought something like > mix = random.shuffle('dog') would do it, but it won't. Any tips? py> def shuffled(s): ... l = list(s) ... random.shuffle(l) ...

Re: mix up a string

2005-06-05 Thread Skip Montanaro
rbt> mix = random.shuffle('dog') Try: lst = list('dog') random.shuffle(lst) print "".join(lst) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI builders considered harmful

2005-06-05 Thread Bruce Stephens
Mike Meyer <[EMAIL PROTECTED]> writes: [...] > The first, and most obvious, thing that GUI builders do is force the > developer to specify an exact position - if not size - for the > graphical elements of the UI. They do? I don't remember them doing that. I just downloaded SpecTcl (a oldish ex

mix up a string

2005-06-05 Thread rbt
What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Killing threads during development.

2005-06-05 Thread Don Garrett
I've been developing with external multi-threaded libraries recently. I find it difficult to use the Python prompt to experiment with these libraries because there isn't any way to just shutdown all threads and try things again. If I try to exit the prompt with background threads running, then

Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)

2005-06-05 Thread Jeff Epler
On Sun, Jun 05, 2005 at 02:38:16PM -0500, Mike Meyer wrote: [...] > The first, and most obvious, thing that GUI builders do is force the > developer to specify an exact position - if not size - for the > graphical elements of the UI. [...] Certainly some---or even most---builders work like this.

what can happen if Python wents commercial ;-) ...

2005-06-05 Thread Claudio Grondi
don't click the following link if you are not at least 18 years old (or don't like sexual related content): http://www.python.com/ Claudio -- http://mail.python.org/mailman/listinfo/python-list

Re: couple of new python articles on onlamp

2005-06-05 Thread Vinay Sajip
Jeremy Jones bellsouth.net> writes: > Python Standard Logging > http://www.onlamp.com/pub/a/python/2005/06/02/logging.html > To echo Thomas Heller's comment - nice article on logging. I'll update the docs so that the stuff about the 4-byte length is a little clearer. Vinay Sajip -- http://m

GUI builders considered harmful (Was: anygui,anydb, any opinions?)

2005-06-05 Thread Mike Meyer
"Thomas Bartkus" <[EMAIL PROTECTED]> writes: > "Paul Rubin" wrote in message >> Are we talking about a drag-and-drop GUI builder? > I am! [...] > I happen to be one - and I *know* I'm not alone - who thinks that building > user interfaces is way too difficult and way too

Re: tkinter, option_add, entry field trouble

2005-06-05 Thread Bob Greschke
Yahoo! That was it. When is Grayson coming out with a new version of "Python and Tkinter Programming"? Mine is getting pretty full of pen & ink changes. :) Nice tip, too! Thanks! <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I think you have to spell it Root.option_add("*En

Re: tkinter, option_add, entry field trouble

2005-06-05 Thread jepler
I think you have to spell it Root.option_add("*Entry*highlightThickness", "2") Root.option_add("*Entry*highlightColor", "green") When you're not sure of the capitalization, do something like this interactively: >>> e.configure('highlightcolor') ('highlightcolor', 'h

tkinter, option_add, entry field trouble

2005-06-05 Thread Bob Greschke
I can't get Root.option_add("*Entry*highlightthickness", "2") Root.option_add("*Entry*highlightcolor", "green") to work. Anyone know why? Setting the font, background color, etc. this way works OK. Are there some options that can't be set "globally"? Setting these two options in the Entry() s

Re: Iterate through a list calling functions

2005-06-05 Thread David Pratt
Cool! Many thanks George. Yes this is the way to go - objects. Much better :-) On Sunday, June 5, 2005, at 02:49 PM, George Sakkis wrote: > David Pratt wrote: >> Hi. I am creating methods for form validation. Each validator has its >> own method and there quite a number of these. For each fi

Re: Iterate through a list calling functions

2005-06-05 Thread David Pratt
Hi Kent. Thank you for your reply. I gave this a go but get the following traceback: ... result = validator(name, value) TypeError: 'str' object is not callable Have put validators in list and iterate over it as in following: validator_list = [isContainedIn,isDate,isDecimal,isEma

Re: If - Or statements

2005-06-05 Thread Roy Smith
venkata subramanian <[EMAIL PROTECTED]> wrote: > It just reminds me that the most important thing about learning a > language is also to learn its style and "paradigm" and not just its > syntax and semantics. Or one might end up wrenching in > "C-like-thinking" into a python program where it might

Re: Iterate through a list calling functions

2005-06-05 Thread George Sakkis
David Pratt wrote: > Hi. I am creating methods for form validation. Each validator has its > own method and there quite a number of these. For each field, I want > to evaluate errors using one or more validators so I want to execute > the appropriate validator methods from those available. I am

how can delay be caused in tcp connection

2005-06-05 Thread abhishek pandey
sir,    i am new to python. plz tell me how to cause delay in sending data through tcp connection. If can be implemented in python then plz let me know.   waiting for reply from anyone   thanx a lot..   its abhishek Discover Yahoo! Get on-the-go sports scores, stock quotes, news & more. Check it

Re: method = Klass.othermethod considered PITA

2005-06-05 Thread Erik Max Francis
Steven Bethard wrote: > Well if you want these to work with subclasses that change verb_hello to > do something else, one option is to write a simple decorator, and then > your lines above become something like: Note I was just giving a use case for the general construct, not necessarily a use

How many threads are too many?

2005-06-05 Thread rbt
This may be a stupid question, but here goes: When designing a threaded application, is there a pratical limit on the number of threads that one should use or is there a way to set it up so that the OS handles the number of threads automatically? I am developing on 32-bit x86 Intel systems wit

Re: maybe a bug in python: NOW Pythonic Gotchas

2005-06-05 Thread Ivan Van Laningham
Hi All-- This little gotcha ought to be number one on "The Official List of Pythonic Gotchas," which should be required reading for everyone. What? There isn't one? Why not? Send me your tired, your poor, your huddled gotchas yearning to breathe free. I'll whup 'em into shape and make a doc pa

Re: maybe a bug in python

2005-06-05 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Just as everyone said, use ('a',) instead of ('a'). As Steve said there are lots of documentation about it. Check the Library Reference at http://www.python.org/doc/current/lib/typesseq.html#l2h-155 or to make things more clear you could read the tuples section in the tutorial at http://docs.python

Re: If - Or statements

2005-06-05 Thread venkata subramanian
I'm sorry if this mail (also) sidetracks the primary theme of this thread. But, it was a moment of "shock and awe" seeing the use of list for checking among multiple options ... which is usually done using a name=opt1 or name=op2 etc., I started as a C programmer and hence, that style of thinkin

Re: Iterate through a list calling functions

2005-06-05 Thread Kent Johnson
David Pratt wrote: > Hi. I am creating methods for form validation. Each validator has its > own method and there quite a number of these. For each field, I want to > evaluate errors using one or more validators so I want to execute the > appropriate validator methods from those available. I

Re: maybe a bug in python

2005-06-05 Thread Steve Horsley
flyaflya wrote: > > >>> a = {1: ("a")} > >>> a[1] > 'a' > why not ('a')? when > >>> a = {1: ((("a")))} > >>> a[1] > 'a' > the result is 'a' too,not ((("a"))).but when use["a"] or ("a","b"),the > tuple is longer than 1, it's no problem. > > > To define a tuple literal with one member, you

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-05 Thread Roy Smith
Nicolas Fleury <[EMAIL PROTECTED]> wrote: > It's important to note that nobody is against the PEP syntax. We are > only talking about adding things to it In think the above is a contradiction in terms. -- http://mail.python.org/mailman/listinfo/python-list

Re: maybe a bug in python

2005-06-05 Thread Torsten Bronger
Hallöchen! flyaflya <[EMAIL PROTECTED]> writes: a = {1: ("a")} a[1] > 'a' > why not ('a')? ("a") is not a tuple, but ("a",) is. Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus -- http://mail.python.org/mailman/listinfo/python-list

Re: maybe a bug in python

2005-06-05 Thread Will McGugan
flyaflya wrote: > > >>> a = {1: ("a")} > >>> a[1] > 'a' > why not ('a')? when > >>> a = {1: ((("a")))} > >>> a[1] > 'a' > the result is 'a' too,not ((("a"))).but when use["a"] or ("a","b"),the > tuple is longer than 1, it's no problem. > > ("a") is just a simple expression. You need to add

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-05 Thread Nicolas Fleury
Steven Bethard wrote: > Can you do the same thing for your proposal? As I understand it you > want some sort of implicitly-defined BLOCK that starts the line after > the with statement and runs to the end of the current block... Yes. I totally agree with the syntax in the PEP, it provides a n

maybe a bug in python

2005-06-05 Thread flyaflya
>>> a = {1: ("a")} >>> a[1] 'a' why not ('a')? when >>> a = {1: ((("a")))} >>> a[1] 'a' the result is 'a' too,not ((("a"))).but when use["a"] or ("a","b"),the tuple is longer than 1, it's no problem. -- [http://www.flyaflya.com/] -- http://mail.python.org/mailman/listinfo/python-li

Iterate through a list calling functions

2005-06-05 Thread David Pratt
Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each va

Re: how to get name of function from within function?

2005-06-05 Thread Christopher J. Bottaro
Steven Bethard wrote: > Christopher J. Bottaro wrote: >> Kent Johnson wrote: >>>class C(object): >>>@in_try >>>def func_a(self): >>>print "func_a" >>> >>>@in_try >>>def func_b(self): >>>print "func_b" >>>raise Exception >>> >>>You could probably crea

Announce: Python for .NET 1.0 RC2 released

2005-06-05 Thread Brian Lloyd
Hi all - I'm happy to announce the release of Python for .NET 1.0 RC2. You can download it from: http://www.zope.org/Members/Brian/PythonNet Highlights of this release: - Changed some uses of Finalize as a static method name that confused the Mono compiler and people reading the cod

Re: Socket Speed

2005-06-05 Thread Dave Brueck
[EMAIL PROTECTED] wrote: > Hi All > > I'm busy writing a python p2p program and would like some advice. > > I'm pushing about 300k/s and would like to know if there are any python > tricks I could pull to speed things up. I'm thinking about unrolling > some of the loops and recuding calls to my c

Re: method = Klass.othermethod considered PITA

2005-06-05 Thread Steven Bethard
John J. Lee wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: >>In Python 2.4: >> >>py> class A(object): >>... def foo(self): >>... print 'foo' >>... bar = foo >>... >>py> import pickle >>py> pickle.loads(pickle.dumps(A)).bar >> >>py> pickle.loads(pickle.dumps(A())).bar() >>foo >

Re: method = Klass.othermethod considered PITA

2005-06-05 Thread John J. Lee
Jeff Epler <[EMAIL PROTECTED]> writes: > On Sat, Jun 04, 2005 at 10:43:39PM +, John J. Lee wrote: > > 1. In derived classes, inheritance doesn't work right: > > Did you expect it to print 'moo'? I'd have been surprised, and expected > the behavior you got. Me too. It's at the time of *writ

Re: Q: functional/equational language, smells a little of Python

2005-06-05 Thread Kay Schluehr
John J. Lee wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> writes: > [...] > > I'm curious why do you think that it "smells like Python"? Because of > > "batteries included"? > > Partly that and the mention of dynamic typing, plus harder-to-pin down > things. > > I didn't mean to say that it was close

Re: method = Klass.othermethod considered PITA

2005-06-05 Thread John J. Lee
Steven Bethard <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > It seems nice to do this > > class Klass: > > def _makeLoudNoise(self, *blah): > > ... > > woof = _makeLoudNoise > > Out of curiosity, why do you want to do this? I don't. It's just a habit I picked up from the

Re: Q: functional/equational language, smells a little of Python

2005-06-05 Thread Robin Becker
John J. Lee wrote: > > What's a fast object library? > ferrarilib :) -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: any macro-like construct/technique/trick?

2005-06-05 Thread Kay Schluehr
Kay Schluehr wrote: > Mac wrote: > > Is there a way to mimic the behaviour of C/C++'s preprocessor for > > macros? The problem: a lot of code like this: > > > > def foo(): > > # do some stuff > > if debug: > > emit_dbg_obj(DbgObjFoo(a,b,c)) > > > > # do more stuff >

Re: Q: functional/equational language, smells a little of Python

2005-06-05 Thread John J. Lee
"Kay Schluehr" <[EMAIL PROTECTED]> writes: [...] > I'm curious why do you think that it "smells like Python"? Because of > "batteries included"? Partly that and the mention of dynamic typing, plus harder-to-pin down things. I didn't mean to say that it was close kin to Python, just that on first

Re: XML help

2005-06-05 Thread Diez B. Roggisch
> > I've managed to test for specific elements and extract values. I want to > place the reults in arrays with array index equal to element ID. So as I > walk the tree I temporarily store IDs and DeptValues in lists. I'm ok so > far. I then intend to create an array of size determined by the maxim

Re: any macro-like construct/technique/trick?

2005-06-05 Thread Kay Schluehr
Mac wrote: > Is there a way to mimic the behaviour of C/C++'s preprocessor for > macros? The problem: a lot of code like this: > > def foo(): > # do some stuff > if debug: > emit_dbg_obj(DbgObjFoo(a,b,c)) > > # do more stuff > if debug: > emit_dbg_obj(Db

Re: What are OOP's Jargons and Complexities?

2005-06-05 Thread Matthias Buelow
Andrea Griffini wrote: >>Of course it is a language, just not a standardized one (if you include >>Borland's extensions that make it practical). > > The history of "runtime error 200" and its handling from > borland is a clear example of what I mean with a product. Hmm, I had to google this up..

Re: Grand Challenge Pegasus Team: Programming Pegasus Bridge 1 ?

2005-06-05 Thread [EMAIL PROTECTED]
Thank you Alex for your feedback. What I am really proposing is for others to test their software on our vehicle for the very reason that there are a lot of unknowns that I cannot believe can directly modeled into an ODE type of engine (as you call it.) Several reasons for this: - one piece of d

Re: Socket Speed

2005-06-05 Thread Jeff Epler
300KB/s sounds dreadfully low. I simply ran "python /usr/lib/python2.3/SimpleHTTPServer.py &", then "wget -O /dev/null http://0.0.0.0:8000/70megfile";. On the best of 4 runs (when the file was cached) wget measured 225.20MB/s. The hardware is a Pentium-M laptop with 768MB RAM runnng at 1.5GHz.

Socket Speed

2005-06-05 Thread mvanaswegen
Hi All I'm busy writing a python p2p program and would like some advice. I'm pushing about 300k/s and would like to know if there are any python tricks I could pull to speed things up. I'm thinking about unrolling some of the loops and recuding calls to my custom socket class and just calling rec

XML help

2005-06-05 Thread chris
I'm 4 months new to python and 4 hours new to XML. I've been trying to understand and use the DOM tree walk sample shown at this site: http://www.rexx.com/~dkuhlman/pyxmlfaq.html to walk through an xml file from which I need to extract data for subsequent plotting. I've repeated the functions from

Re: csv and iterator protocol

2005-06-05 Thread Philippe C. Martin
Thanks Kent, I had a bug in my test program: it works fine with strings Philippe Kent Johnson wrote: > Philippe C. Martin wrote: >> Can I initialize csv with input data stored in RAM (ex: a string) ? - so >> far I cannot get that to work. Or to rephrase the question, what Python >> "RAM" stru

Re: any macro-like construct/technique/trick?

2005-06-05 Thread Roy Smith
"Mac" <[EMAIL PROTECTED]> wrote: > Is there a way to mimic the behaviour of C/C++'s preprocessor for > macros? > [...] > > * using >def debug_emit(obj): >if debug: >emit_dbg_obj(obj) > is a poor solution, because it *always* instantiates DbgObj*, even when > not needed; I w

Re: any macro-like construct/technique/trick?

2005-06-05 Thread Andrew Dalke
Mike Meyer wrote: > I've never tried it with python, but the C preprocessor is available > as 'cpp' on most Unix systesm. Using it on languages other than C has > been worthwhile on a few occasions. It would certainly seem to > directly meet the OP's needs. Wouldn't that prohibit using #comments i

  1   2   >