Re: f---ing typechecking

2007-02-14 Thread Paul McGuire
Since tuples are immutable, I think of them as fixed data objects with some simple sequential structure, as opposed to lists which are much more dynamically accessible/updateable data containers. Back in my relational database design days, I sometimes had to create a primary key for a table by com

How to write a programe that include both pipe(low speed system call) and signal

2007-02-14 Thread Marco
Hi, I have know that signal will interrupt some kind low speed system call like pipe. But how to design a program that both support signal and pipe? I have a mplayer.py to play movie via os.popen2() and mplayer slave mode. And there is a mplayer_ctl.py send signal to mplayer.py to trigger

Re: f---ing typechecking

2007-02-14 Thread Sergey Dorofeev
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It's effectively a tuple with field names. I don't know when the switch > occurred (it's in 2.2, as far back as my built interpreter versions > currently go), but back in the day os.stat used to return a plain old > tuple. posix.sta

Re: Method overloading?

2007-02-14 Thread Paul McGuire
On Feb 15, 12:23 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 14 Feb 2007 21:58:35 -0800, Paul McGuire wrote: > > No, Python does not do overloading as part of the language, you have > > to do the variable argument interpretation for yourself. > > > For instance, if you want a method to

Re: f---ing typechecking

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 22:21:43 -0800, James Stroud wrote: >> The user's expected behaviour for [1] + (1,) might be to return a list, or >> it might be to return a tuple. Since there is no obviously correct >> behaviour, the right thing to do is to refuse to guess. > > I guess we differ on what is o

Re: AUX File Writing Error

2007-02-14 Thread John Machin
On Feb 15, 4:03 pm, [EMAIL PROTECTED] wrote: > Hi guys! > > I'm new to python so please be aware that I'm probably missing the > obvious. Here's my problem... > > >>> t = "AUX" > >>> f = open('c:\\' + t + '.csv', 'a') > > Traceback (most recent call last): > File "", line 1, in > f = open('c

Re: threading and multicores, pros and cons

2007-02-14 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > But there are dumb thread implementations that make > a system call for every lock. Yes, a sys call on each lock access would really be horrendous. But I think that in a modern cpu, LOCK XCHG costs as much as hundreds of regular instructions. Doing t

Re: Method overloading?

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 21:58:35 -0800, Paul McGuire wrote: > No, Python does not do overloading as part of the language, you have > to do the variable argument interpretation for yourself. > > For instance, if you want a method to accept a single argument of > various types, it would look something

Re: f---ing typechecking

2007-02-14 Thread James Stroud
Steven D'Aprano wrote: > On Wed, 14 Feb 2007 19:45:14 -0800, James Stroud wrote: >>Steven D'Aprano wrote: >>>Since lists and tuples are completely different objects with completely >>>different usages, what should concatenating a list and a tuple give? >>>Should it depend on the order you pass them

Re: threading and multicores, pros and cons

2007-02-14 Thread John Nagle
Paul Rubin wrote: > John Nagle <[EMAIL PROTECTED]> writes: > >>If locking is expensive on x86, it's implemented wrong. >>It's done right in QNX, with inline code for the non-blocking case. > > > Acquiring the lock still takes an expensive instruction, LOCK XCHG or > whatever. I think QNX is

Enter Enter... troubles

2007-02-14 Thread Sorin Schwimmer
Hi All, In my application I have a class like this: from Tkinter import * class MyClass: def __init__(self, root): self.property=value self.aButton=Button(root, text='Press me!') self.aButton.bind('', self.handler) self.aButton.bind('',self.handler)

Re: Method overloading?

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 21:12:39 -0800, placid wrote: > On Feb 15, 4:04 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-02-15, placid <[EMAIL PROTECTED]> wrote: >> >> >> >> > Is it possible to be able to do the following in Python? >> >> > class Test: >> > def __init__(self): >> >

Re: threading and multicores, pros and cons

2007-02-14 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > If locking is expensive on x86, it's implemented wrong. > It's done right in QNX, with inline code for the non-blocking case. Acquiring the lock still takes an expensive instruction, LOCK XCHG or whatever. I think QNX is usually run on embedded cpu's w

Re: Method overloading?

2007-02-14 Thread Paul McGuire
On Feb 14, 10:54 pm, "placid" <[EMAIL PROTECTED]> wrote: > Hi all, > > Is it possible to be able to do the following in Python? > > class Test: > def __init__(self): > pass > > def puts(self, str): > print str > > def puts(self, str,str2): > print str,str2 > > if

Re: threading and multicores, pros and cons

2007-02-14 Thread John Nagle
If locking is expensive on x86, it's implemented wrong. It's done right in QNX, with inline code for the non-blocking case. Not sure about the current libraries for Linux, but by now, somebody should have gotten this right. John Nagle Paul Rubin wrote: > Maric

Re: threading and multicores, pros and cons

2007-02-14 Thread Paul Rubin
Maric Michaud <[EMAIL PROTECTED]> writes: > > "Some time back, a group did remove the GIL from the python core, and > > implemented locks on the core code to make it threadsafe. Well, the > > problem was that while it worked, the necessary locks it made single > > threaded code take significantly l

Re: Method overloading?

2007-02-14 Thread placid
On Feb 15, 4:04 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-02-15, placid <[EMAIL PROTECTED]> wrote: > > > > > Is it possible to be able to do the following in Python? > > > class Test: > > def __init__(self): > > pass > > > def puts(self, str): > > print str > >

Re: Method overloading?

2007-02-14 Thread Grant Edwards
On 2007-02-15, placid <[EMAIL PROTECTED]> wrote: > Is it possible to be able to do the following in Python? > > class Test: > def __init__(self): > pass > > def puts(self, str): > print str > > def puts(self, str,str2): > print str,str2 > > if __name__ == "__mai

AUX File Writing Error

2007-02-14 Thread thewritersclub
Hi guys! I'm new to python so please be aware that I'm probably missing the obvious. Here's my problem... >>> t = "AUX" >>> f = open('c:\\' + t + '.csv', 'a') Traceback (most recent call last): File "", line 1, in f = open('c:\\' + t + '.csv', 'a') IOError: [Errno 2] No such file or direc

Method overloading?

2007-02-14 Thread placid
Hi all, Is it possible to be able to do the following in Python? class Test: def __init__(self): pass def puts(self, str): print str def puts(self, str,str2): print str,str2 if __name__ == "__main__": t = Test() t.puts("hi") t.puts("hi","hello")

Re: f---ing typechecking

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 19:45:14 -0800, James Stroud wrote: > Steven D'Aprano wrote: >> On Wed, 14 Feb 2007 13:25:21 -0800, James Stroud wrote: >> >> >>>But then again, the unimaginative defense would be that it wouldn't be >>>python if you could catentate a list and a tuple. >> >> >> Since lists

Re: How much memory used by a name

2007-02-14 Thread placid
On Feb 15, 11:08 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Bernard Lebel a écrit : > > > Diez: thanks, I will try that. However isn't sum() returning an > > integer that here would represent the number of elements? > > Nope, it will return the sum of the length of the lines in the list.

Re: threading and multicores, pros and cons

2007-02-14 Thread Maric Michaud
Le mercredi 14 février 2007 16:24, [EMAIL PROTECTED] a écrit : > "Some time back, a group did remove the GIL from the python core, and > implemented locks on the core code to make it threadsafe. Well, the > problem was that while it worked, the necessary locks it made single > threaded code take si

Re: f---ing typechecking

2007-02-14 Thread James Stroud
[EMAIL PROTECTED] wrote: > >> Concatenating tuples and lists seems logical if you think of tuples > >> as sequences. If you think of them more like Pascal records or C > >> structs instead (I believe that's Guido's perspective on tuples) then > >> it makes no sense at all. > >

Roundup Issue Tracker release 1.3.3

2007-02-14 Thread Richard Jones
I'm proud to release version 1.3.3 of Roundup. Fixed in 1.3.3: - If-Modified-Since handling was broken - Updated documentation for customising hard-coded searches in page.html - Updated Windows installation docs (thanks Bo Berglund) - Handle rounding of seconds generating invalid date values - Ha

Re: f---ing typechecking

2007-02-14 Thread James Stroud
Steven D'Aprano wrote: > On Wed, 14 Feb 2007 13:25:21 -0800, James Stroud wrote: > > >>But then again, the unimaginative defense would be that it wouldn't be >>python if you could catentate a list and a tuple. > > > Since lists and tuples are completely different objects with completely > diff

Re: python not returning true

2007-02-14 Thread Terry Reedy
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] || > | On Feb 14, 5:45 pm, "agent-s" <[EMAIL PROTECTED]> wrote: | > | > btw Steven you are so witty I hope to one day pwn noobs on newsgroups | > | > too. | > | > Sorry, but you are 'pwning' yourself here ;-) | | And the r

Re: Recursive calls and stack

2007-02-14 Thread Szabolcs Nagy
[EMAIL PROTECTED] wrote: > Hi, > I have a program which literately finds the object that overlapping a > point. The horizontal and vertical search are called recursively from > inside each other. > ... in case you ever need deeply nested recursion: one solution is to use the already mentioned sy

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Paul Rubin
Paul Rubin writes: > Re your other post: yes, PEP 363 explains how the "with" statement Whoops, 343. -- http://mail.python.org/mailman/listinfo/python-list

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Yes it does. Eventually f goes out of scope and is closed automatically. Oh right, however you can't really predict when the closure occurs, unless you're relying on current CPython artifacts. Re your other post: yes, PEP 363 explains how the "with" s

A problem of using pyfort

2007-02-14 Thread g950101
Hi, I faced some problems during using pyfort. The log for installing pyfort is attached: running install running build running build_py running build_scripts copying pyfort -> build/scripts-2.4 changing mode of build/scripts-2.4/pyfort from 644 to 755 running install_lib running install_scripts c

Re: list of range of floats

2007-02-14 Thread Steve
On Wed, 14 Feb 2007 18:46:34 +, Simon Brunning wrote: > On 2/14/07, Steve <[EMAIL PROTECTED]> wrote: >> After re-reading my original post I was pretty vague. I'm trying to creat >> a list of ranges of floats, 0.0 10.0, 11 20, etc then checking to see if >> an float, example 12.5 falls in the l

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Steven D'Aprano
Replying to my own question... On Thu, 15 Feb 2007 13:17:00 +1100, Steven D'Aprano wrote: > I don't see where the "with" version closes the file either. How does it > know that I want to call the f's close() method, rather than, say, > f.exit() or f.do_something_else()? Ah, I *think* I see... fi

Re: pyscripter

2007-02-14 Thread PyScripter
On Feb 15, 12:41 am, Gigs_ <[EMAIL PROTECTED]> wrote: > How to change syntax color inpyscripterfor python interpreter? > > I have change color in tools>options>editor options and everything is > fine till restartpyscripter. > After restart only in module is good syntax color, but in interpreter is

Re: builtin set literal

2007-02-14 Thread faulkner
On Feb 14, 11:55 am, Schüle Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > lst = list((1,2,3)) > lst = [1,2,3] > > t = tupel((1,2,3)) > t = (1,2,3) > > s = set((1,2,3)) > s = ... > > it would be nice feature to have builtin literal for set type > maybe in P3 .. what about? > s = <1,2,3> > > Regards

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 18:03:19 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> self.isDataLoaded = False >> try: >> f = open(self.filename, 'rb') >> f.seek(DATA_OFFSET) >> self.__data = f.read(DATA_SIZE) >> self.isDataLoaded = True >> except: >> pass >>

Re: ANN: Python Call Graph 0.3.0

2007-02-14 Thread Beej
On Feb 14, 3:02 pm, "Gerald Kaszuba" <[EMAIL PROTECTED]> wrote: > I just released pycallgraph 0.3.0. There are many examples on the web > site and linked from the web site including a 16188 x 4187 sized call > graph! That's pretty cool, all right. -Beej -- http://mail.python.org/mailman/listinf

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > self.isDataLoaded = False > try: > f = open(self.filename, 'rb') > f.seek(DATA_OFFSET) > self.__data = f.read(DATA_SIZE) > self.isDataLoaded = True > except: > pass > else: > pass > > (apart from being four lines shorter) Your

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 12:09:34 -0800, Paul Rubin wrote: > "redawgts" <[EMAIL PROTECTED]> writes: >> try: >> f = file(self.filename, 'rb') ... >> Can someone tell me what's wrong with the code? > > Various people have explained the error: if the file open attempt > fails, f is n

builtin set literal

2007-02-14 Thread Schüle Daniel
Hello, lst = list((1,2,3)) lst = [1,2,3] t = tupel((1,2,3)) t = (1,2,3) s = set((1,2,3)) s = ... it would be nice feature to have builtin literal for set type maybe in P3 .. what about? s = <1,2,3> Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: f---ing typechecking

2007-02-14 Thread Steven D'Aprano
On Wed, 14 Feb 2007 13:25:21 -0800, James Stroud wrote: > But then again, the unimaginative defense would be that it wouldn't be > python if you could catentate a list and a tuple. Since lists and tuples are completely different objects with completely different usages, what should concatenating

Re: output to console and to multiple files

2007-02-14 Thread Gabriel Genellina
En Wed, 14 Feb 2007 19:28:34 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I'm looking for a way to output stdout/stderr (from a subprocess or > spawn) to screen and to at least two different files. Look at the tee command. If you control the subprocess, and it's written in Python,

Re: Recursive calls and stack

2007-02-14 Thread Gabriel Genellina
En Wed, 14 Feb 2007 10:41:53 -0300, Neil Cerutti <[EMAIL PROTECTED]> escribió: > On 2007-02-14, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> Python does not do "tail recursion optimization" (at >> least, I'm not aware of that). > > To be just a little pedantic, it's "tail call optimization".

Re: anyway to create a table-like object?

2007-02-14 Thread James Stroud
James Stroud wrote: > Wensui Liu wrote: > >> Dear all, >> >> is there a way to create a 2-dimension-table-like object such that I >> can reference a whole column directly using something like : >> mytable.column1 ? >> >> by the way, can python be used for database programming to pull large >> volu

Re: anyway to create a table-like object?

2007-02-14 Thread James Stroud
Wensui Liu wrote: > Dear all, > > is there a way to create a 2-dimension-table-like object such that I > can reference a whole column directly using something like : > mytable.column1 ? > > by the way, can python be used for database programming to pull large > volume data (hundred M or even seve

Re: output to console and to multiple files

2007-02-14 Thread goodwolf
like this? class Writers (object): def __init__(self, *writers): self.writers = writers def write(self, string): for w in self.writers: w.write(string) def flush(self): for w in self.writers: w.flush(): import sys logfile = open('log

Re: output to console and to multiple files

2007-02-14 Thread Matimus
I took a look around and I couldn't find anything either. I will be keeping an eye on this thread to see if someone posts a more standard solution. In the mean time though, I will offer up a potential solution. Duck typing is your friend. If you are only using the write method of your files, it can

Re: f---ing typechecking

2007-02-14 Thread skip
>> Concatenating tuples and lists seems logical if you think of tuples >> as sequences. If you think of them more like Pascal records or C >> structs instead (I believe that's Guido's perspective on tuples) then >> it makes no sense at all. James> Then iterating over them mak

Re: c++ for python programmers

2007-02-14 Thread Neil Cerutti
On 2007-02-14, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Thomas Nelson <[EMAIL PROTECTED]> wrote: >>I realize I'm approaching this backwards from the direction >>most people go, but does anyone know of a good c/c++ >>introduction for python programmers? > > This isn't an i

Re: c++ for python programmers

2007-02-14 Thread Aahz
In article <[EMAIL PROTECTED]>, Thomas Nelson <[EMAIL PROTECTED]> wrote: > >I realize I'm approaching this backwards from the direction most >people go, but does anyone know of a good c/c++ introduction for >python programmers? This isn't an introduction, but you should probably also pick up _Effe

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Martin P. Hellwig
[EMAIL PROTECTED] wrote: > Martin P. Hellwig >> for me (personal) being Pythonic means that I should >> separate the logic and variables, etc... > > Well, for me me Pythonic means using built-in functionalities as much > as possible (like using encode("rot13") or translate), and to write > less co

Re: How much memory used by a name

2007-02-14 Thread Bruno Desthuilliers
Bernard Lebel a écrit : > Diez: thanks, I will try that. However isn't sum() returning an > integer that here would represent the number of elements? Nope, it will return the sum of the length of the lines in the list. The long way to write it is: total = 0 for line in thelist: total += len(l

Re: threading and multicores, pros and cons

2007-02-14 Thread MRAB
On Feb 14, 3:24 pm, [EMAIL PROTECTED] wrote: > On Feb 13, 9:07 pm, Maric Michaud <[EMAIL PROTECTED]> wrote: > > > I've heard of a bunch of arguments to defend python's choice of GIL, but I'm > > not quite sure of their technical background, nor what is really important > > and what is not. These di

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Paul Rubin
"Andy Dingley" <[EMAIL PROTECTED]> writes: > c_rot13 = lambdaf c : (((c, uc_rot13(c)) [c in > 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']), lc_rot13(c) )[c in > 'abcdefghijklmnopqrstuvwxyz'] Oh, I see what you mean, you have separate upper and lower case maps and you're asking how to select one in an expression

Re: threading and multicores, pros and cons

2007-02-14 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > question of library functions--you could certainly write JNI > > extensions for that stuff [access to mmap, etc.] > Sure. If you're writing extensions you can work around the GIL, too. I don't think that's comparable--if you have extensions turn

Re: rot13 in a more Pythonic style?

2007-02-14 Thread bearophileHUGS
Martin P. Hellwig > for me (personal) being Pythonic means that I should > separate the logic and variables, etc... Well, for me me Pythonic means using built-in functionalities as much as possible (like using encode("rot13") or translate), and to write less code, (avoiding overgeneralizations fro

anyway to create a table-like object?

2007-02-14 Thread Wensui Liu
Dear all, is there a way to create a 2-dimension-table-like object such that I can reference a whole column directly using something like : mytable.column1 ? by the way, can python be used for database programming to pull large volume data (hundred M or even several Gs) out of large database and

Re: threading and multicores, pros and cons

2007-02-14 Thread [EMAIL PROTECTED]
On Feb 14, 4:37 pm, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Java has historically had no support at all for real multiple process > > solutions (akin to fork() or ZwCreateProcess() with NULL > > SectionHandle), which should make up the vast

Re: f---ing typechecking

2007-02-14 Thread James Stroud
[EMAIL PROTECTED] wrote: > Concatenating tuples and lists seems logical if you think of tuples as > sequences. If you think of them more like Pascal records or C structs > instead (I believe that's Guido's perspective on tuples) then it makes no > sense at all. > > Skip > Then iterating over th

ANN: Python Call Graph 0.3.0

2007-02-14 Thread Gerald Kaszuba
Hi, I just released pycallgraph 0.3.0. There are many examples on the web site and linked from the web site including a 16188 x 4187 sized call graph! http://pycallgraph.slowchop.com/ The changes are: * Renamed make_graph to make_dot_graph to allow different output types in the future * Callback

pyscripter

2007-02-14 Thread Gigs_
How to change syntax color in pyscripter for python interpreter? I have change color in tools>options>editor options and everything is fine till restart pyscripter. After restart only in module is good syntax color, but in interpreter is back to default. thx -- http://mail.python.org/mailman/l

RE: python not returning true

2007-02-14 Thread Delaney, Timothy (Tim)
John Machin wrote: agent-s wrote: >> btw Steven you are so witty I hope to one day pwn noobs on newsgroups >> too. > > Wit has nothing to do with it. The fact that you are a Python noob is > also irrelevant. Your problem statement was unintelligible, as is your > response. What does "pwn" mean?

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread redawgts
Thanks everybody, that helped alot. -- http://mail.python.org/mailman/listinfo/python-list

output to console and to multiple files

2007-02-14 Thread [EMAIL PROTECTED]
Hello, I searched on Google and in this Google Group, but did not find any solution to my problem. I'm looking for a way to output stdout/stderr (from a subprocess or spawn) to screen and to at least two different files. eg. stdout/stderr -> screen stdout -> log.out stderr -> log.err and if pos

Re: f---ing typechecking

2007-02-14 Thread skip
Concatenating tuples and lists seems logical if you think of tuples as sequences. If you think of them more like Pascal records or C structs instead (I believe that's Guido's perspective on tuples) then it makes no sense at all. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: swf format verification?

2007-02-14 Thread Bjoern Schliessmann
akonsu wrote: > hello, can someone recommend a good library to verify whether a > file is in swf format (and ideally flv as well)? i need it to > enable file uploading on to my web site. Look how GNU "file" does it: #--

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Paul Rubin
"Andy Dingley" <[EMAIL PROTECTED]> writes: > I'm trying to write rot13, but to do it in a better and more Pythonic > style than I'm currrently using. What would you reckon to the > following pretty ugly thing? How would you improve it? In > particular, I don't like the way a three-way selection

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Rob Wolfe
"Andy Dingley" <[EMAIL PROTECTED]> writes: > I'm trying to write rot13, but to do it in a better and more Pythonic > style than I'm currrently using. What would you reckon to the > following pretty ugly thing? How would you improve it? In > particular, I don't like the way a three-way selectio

Re: f---ing typechecking

2007-02-14 Thread Sergey Dorofeev
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >[1]+(1,) >> >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: can only concatenate list (not "tuple") to list >> >> >> Its ugly and boring. > > Agreed. This would be similar to: > > py> 1

Re: f---ing typechecking

2007-02-14 Thread Farshid Lashkari
Szabolcs Nagy wrote: L=[1] L.extend((1,)) L > [1, 1] Are list.extend() and list concatenation supposed to behave differently? I always thought concatenation was just shorthand for calling extend(). However the following seems to work: >>> L = [1] >>> L += (2,) >>> L [1, 2

swf format verification?

2007-02-14 Thread akonsu
hello, can someone recommend a good library to verify whether a file is in swf format (and ideally flv as well)? i need it to enable file uploading on to my web site. thanks konstantin -- http://mail.python.org/mailman/listinfo/python-list

Re: threading and multicores, pros and cons

2007-02-14 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Java has historically had no support at all for real multiple process > solutions (akin to fork() or ZwCreateProcess() with NULL > SectionHandle), which should make up the vast majority of parallel > programs (basically all of those except where you

Re: f---ing typechecking

2007-02-14 Thread hg
> Its ugly and boring. It's rude, unnecessary _and_ boring -- http://mail.python.org/mailman/listinfo/python-list

Re: f---ing typechecking

2007-02-14 Thread James Stroud
Sergey Dorofeev wrote: > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > (1,)+[1] > > Traceback (most recent call last): > File "", line 1, in > TypeError: can only concatenate

Re: threading and multicores, pros and cons

2007-02-14 Thread [EMAIL PROTECTED]
On Feb 14, 1:44 am, Paul Rubin wrote: > > When a customer comes with his new beautiful dual-core server and > > get a basic plone install up and running, he will immediately > > compare it to J2EE and wonder why he should pay a consultant to make > > it work properly. At

ANN: Pygments 0.7 "Faschingskrapfn" released

2007-02-14 Thread Georg Brandl
I'm very pleased to announce the third public release of Pygments, the generic Python syntax highlighter. Download it from , or look at the demonstration at . News The new features since 0.6 include: * New lexers for

Re: f---ing typechecking

2007-02-14 Thread Szabolcs Nagy
Sergey Dorofeev wrote: > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> (1,)+[1] > Traceback (most recent call last): > File "", line 1, in > TypeError: can only concatenate tupl

f---ing typechecking

2007-02-14 Thread Sergey Dorofeev
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> (1,)+[1] Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate tuple (not "list") to tuple >>> [1]+(1,)

Re: reference data in a dictionary

2007-02-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Wensui Liu wrote: > I know dict['row1'] will always work. but it will only get 1 row out > of the dict. is there anyway i can get multiple (>1) rows out of dict > by directly refeencing them, something like dict[['row1', 'row2']]. Not by directly referencing them, but with

Re: reference data in a dictionary

2007-02-14 Thread Wensui Liu
I know dict['row1'] will always work. but it will only get 1 row out of the dict. is there anyway i can get multiple (>1) rows out of dict by directly refeencing them, something like dict[['row1', 'row2']]. thank you for reply, Ben. wensui On 2/14/07, Ben Finney <[EMAIL PROTECTED]> wrote: > "Wen

Re: How much memory used by a name

2007-02-14 Thread Bernard Lebel
Diez: thanks, I will try that. However isn't sum() returning an integer that here would represent the number of elements? Bruno: good question. We're talking about text files that can have 300,000 lines, if not more. Currently, the way I have coded the file writing, every line calls for a write()

Re: reference data in a dictionary

2007-02-14 Thread Ben Finney
"Wensui Liu" <[EMAIL PROTECTED]> writes: > i am new to python and have a question about referencing data in a > dict. is there anyway that allows me to do something like: > dict[['row1', 'row2', .'row100']] What behaviour would you expect from that statement? If we know what you're trying t

Re: threading and multicores, pros and cons

2007-02-14 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Maric Michaud <[EMAIL PROTECTED]> wrote: > This is a recurrent problem I encounter when I try to sell python solutions > to > my customers. I'm aware that this problem is sometimes overlooked, but here > is the market's law. > > I've heard of a bunch of argumen

reference data in a dictionary

2007-02-14 Thread Wensui Liu
dear all, i am new to python and have a question about referencing data in a dict. is there anyway that allows me to do something like: dict[['row1', 'row2', .'row100']] thanks much. -- WenSui Liu A lousy statistician who happens to know a little programming (http://spaces.msn.com/statcomput

Re: How much memory used by a name

2007-02-14 Thread Bruno Desthuilliers
Bernard Lebel a écrit : > Hello, > > I would like to know if there is a way to know how much memory (bytes, > kilobytes, megabytes, etc) a name is using. > > More specifically, I have this list of strings that I want to write to > a file as lines. > This list grows througout the script execution,

Re: Segmentation faults using threads

2007-02-14 Thread John Nagle
Mathias wrote: >> >> What module are you using for SSH? >> >> What's in your program that isn't pure Python? >> The problem is probably in some non-Python component; you shouldn't >> be able to force a memory protection error from within Python code. >> > > It looks like the error could be

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Paul Rubin
"redawgts" <[EMAIL PROTECTED]> writes: > try: > f = file(self.filename, 'rb') ... > Can someone tell me what's wrong with the code? Various people have explained the error: if the file open attempt fails, f is never assigned. Doing it the right way (i.e. handling the potentia

Re: rot13 in a more Pythonic style?

2007-02-14 Thread Beej
On Feb 14, 9:04 am, "Andy Dingley" <[EMAIL PROTECTED]> wrote: > I still don't understand what a lambda is _for_ in Python. Python supports functional programming to a certain extent, and lambdas are part of this. http://linuxgazette.net/109/pramode.html > I know what > they are, I know what the

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Larry Bates
redawgts wrote: > I keep getting this error "local variable 'f' referenced before > assignment" in the finally block when I run the following code. > > try: > f = file(self.filename, 'rb') > f.seek(DATA_OFFSET) > self.__data = f.read(DATA_SIZE) >

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Andrew Koenig
"redawgts" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I keep getting this error "local variable 'f' referenced before > assignment" in the finally block when I run the following code. > >try: >f = file(self.filename, 'rb') >f.seek(DATA_OFFSET) >

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Robert Kern
redawgts wrote: > I keep getting this error "local variable 'f' referenced before > assignment" in the finally block when I run the following code. > > try: > f = file(self.filename, 'rb') > f.seek(DATA_OFFSET) > self.__data = f.read(DATA_SIZE) >

Re: try...except...finally problem in Python 2.5

2007-02-14 Thread Jean-Paul Calderone
On 14 Feb 2007 11:41:29 -0800, redawgts <[EMAIL PROTECTED]> wrote: >I keep getting this error "local variable 'f' referenced before >assignment" in the finally block when I run the following code. > >try: >f = file(self.filename, 'rb') >f.seek(DATA_OFFSET) >

try...except...finally problem in Python 2.5

2007-02-14 Thread redawgts
I keep getting this error "local variable 'f' referenced before assignment" in the finally block when I run the following code. try: f = file(self.filename, 'rb') f.seek(DATA_OFFSET) self.__data = f.read(DATA_SIZE) self.isDataLoaded = True

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Neil Cerutti
On 2007-02-14, Peter Otten <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > >> On 2007-02-13, Peter Otten <[EMAIL PROTECTED]> wrote: >>> Well, what problems ocurring with >>> >>> class A: pass >>> class B: pass >>> class C(A, B): pass >>> >>> could be avoided by writing >>> >>> class A: pass >>>

Re: Testers please

2007-02-14 Thread Martien Friedeman
That's amazing! We had the same idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: list of range of floats

2007-02-14 Thread Simon Brunning
On 2/14/07, Steve <[EMAIL PROTECTED]> wrote: > After re-reading my original post I was pretty vague. I'm trying to creat > a list of ranges of floats, 0.0 10.0, 11 20, etc then checking to see if > an float, example 12.5 falls in the list and if so get the list index of > where it is in the index.

Re: list of range of floats

2007-02-14 Thread Steve
On Wed, 14 Feb 2007 17:29:26 +, Simon Brunning wrote: > On 2/14/07, Steve <[EMAIL PROTECTED]> wrote: >> I'm trying to create a list range of floats and running into problems. >> I've been trying something like: >> >> a = 0.0 >> b = 10.0 >> >> flts = range(a, b) >> >> fltlst.append(flts) >> >>

Re: Newbie Question

2007-02-14 Thread David Boddie
On Tuesday 13 February 2007 11:04, [EMAIL PROTECTED] wrote: > To be true, I don't know if any of these toolkits (GTK, wxWindows, QT) > and their GUIDesigners have the features you like in Delphi. What I > know is that: > 1/ these three toolkits have everything *needed* to write serious GUI > apps

Re: How to ping and shutdown a remote computer?

2007-02-14 Thread joja15
On Feb 14, 10:09 am, Christophe <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > > > I am working on a Python script to perform as a remote computer > > manager. So far I have a WOL function working and I would like to add > > the ability to show if a machine is on or off (I figured I

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Peter Otten
massimo s. wrote: > On 13 Feb, 12:46, Peter Otten <[EMAIL PROTECTED]> wrote: >> Well, what problems ocurring with >> >> class A: pass >> class B: pass >> class C(A, B): pass >> >> could be avoided by writing >> >> class A: pass >> class B(A): pass >> class C(B): pass >> >> instead? Classes have to

  1   2   >