Re: lies about OOP

2004-12-13 Thread Tim Daneliuk
projecktzero wrote: I know this might not be the correct group to post this, but I thought I'd start here. A co-worker considers himself "old school" in that he hasn't seen the light of OOP.(It might be because he's in love with Perl...but that's another story.) He thinks that OOP has more overhead

Re: how can I import a module without using pythonpath?

2004-12-13 Thread Fredrik Lundh
Doug Holton wrote: >> I'm using python 2.2, I want to import a module by referring to its relative >> location. The reason >> for this is that there is another module with the same name that's already >> in pythonpath( not my >> decision, but I got to work around it, bummer). So is there any e

Re: New versions breaking extensions, etc.

2004-12-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jive <[EMAIL PROTECTED]> wrote: . . . >Bit by bit, I am remembering now just how stupifyingly brain-dead the MS DLL >scheme is. . .

lies about OOP

2004-12-13 Thread projecktzero
I know this might not be the correct group to post this, but I thought I'd start here. A co-worker considers himself "old school" in that he hasn't seen the light of OOP.(It might be because he's in love with Perl...but that's another story.) He thinks that OOP has more overhead and is slower than

Re: ANN: IPython 0.6.5 is out.

2004-12-13 Thread Fernando Perez
Fernando Perez wrote: > I'm glad to announce the release of IPython 0.6.6. IPython's homepage is at: Sorry, the _title_ was incorrect. 0.6.6 is indeed a new release put out today, I just copied an old title and missed the change. Regards, f -- http://mail.python.org/mailman/listinfo/python-

Re: lies about OOP

2004-12-13 Thread Steve Holden
Paul McGuire wrote: "Jive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] But by '86, the Joy of OOP was widely known. "Widely known"? Errr? In 1986, "object-oriented" programming was barely marketing-speak. Computing hardware in the mid-80's just wasn't up to the task of dealing

Re: Help need with converting Hex string to IEEE format float

2004-12-13 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > Newbie Python programmer here, so please be patient. I have spent all > day googling for an answer to my problem, but everything I try fails to > work (or works from the Interpreter with a set value but not from my > code with dynamic values). > > Okay, here is the gen

Re: PyQt on MAC OS X

2004-12-13 Thread Michael McGarry
whamoo wrote: Michael McGarry <[EMAIL PROTECTED]> wrote: thanks that did the trick!!! One problem is my Window created in Qt appears underneath all others on the screen and focus never goes completely onto this window. Kind of weird. Any ideas? You must use pythonw for graphics application =) So

Re: gather information from various files efficiently

2004-12-13 Thread Peter Hansen
Keith Dart wrote: Sigh, this reminds me of a discussion I had at my work once... It seems to write optimal Python code one must understand various probabilites of your data, and code according to the likely scenario. And this is different from optimizing in *any* other language in what way? -Pet

Re: [dictionary] how to get key by item

2004-12-13 Thread Skip Montanaro
Egor> i know how to get item by key ... Egor> but i wonder how to get key by item Assuming your dictionary defines a one-to-one mapping, just invert it: >>> forward = {10 : 50, 2 : 12, 4 : 43} >>> reverse = dict([(v,k) for (k,v) in forward.iteritems()]) >>> print forward

Help need with converting Hex string to IEEE format float

2004-12-13 Thread i_vincent
Hi all, Newbie Python programmer here, so please be patient. I have spent all day googling for an answer to my problem, but everything I try fails to work (or works from the Interpreter with a set value but not from my code with dynamic values). Okay, here is the general gist of the problem. I am

Re: Regexp problem, which pattern to use in split

2004-12-13 Thread Hans Almåsbakk
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > >>> import csv > > http://online.effbot.org/2003_08_01_archive.htm#librarybook-csv-module > This seems be just the thing I need. Now ofcourse, another problem arouse: The csv module is new in Python 2.3. hans:~# python -V Python 2.1.3 Is there a

Re: need some help quickly

2004-12-13 Thread Thomas Guettler
Am Tue, 14 Dec 2004 04:46:24 -0800 schrieb Allan Irvine: > HI > > Hope this is the right place for this, I am new. I have a spec to > create > a (dual screen) framework application that > > 1 displays mp3, flash, jpegs etc. on top screen > 2: displays buttons on bottom screen which alter image w

Re: Looking for a coder to do some work

2004-12-13 Thread John Hunter
> "Cameron" == Cameron Laird <[EMAIL PROTECTED]> writes: Cameron> I don't understand the last sentence; in particular, Cameron> "fort hsi" is beyond my power to decode unambiguously. "for this", clearly JDH -- http://mail.python.org/mailman/listinfo/python-list

Re: RegEx: find all occurances of a single character in a string

2004-12-13 Thread Fredrik Lundh
Franz Steinhaeusler wrote: > given a string: > > st="abcdatraataza" >^ ^ ^ ^ (these should be found) > I want to get the positions of all single 'a' characters. for m in re.finditer("a+", st): if len(m.group()) == 1: print m.start() or, perhaps: indexes = [m.start() for m i

Re: Regexp problem, which pattern to use in split

2004-12-13 Thread Matthias Huening
Hans Almåsbakk (14.12.2004 16:02): Any pointer will be greatly appreciated. Maybe I'm attacking this problem the wrong way already from the start? (Not that I can see another way myself :) Hans, did you try the csv module in the Python library? Matthias -- http://mail.python.org/mailman/listinfo/py

[dictionary] how to get key by item

2004-12-13 Thread Egor Bolonev
saluton al ciuj i know how to get item by key == dict = {10 : 50, 2 : 12, 4 : 43} print dict[2] 12 but i wonder how to get key by item print dict[12] 2 == is there a more fast way than that one (my dictionary is really big) == dict = {10 : 50, 2 : 12,

Re: Organising data within a program

2004-12-13 Thread James Stroud
Python is an object oriented (OO) language. The very best thing if you have a lot of time is to learn the language fully, read several books on database design, and implement a gui driven app, OO from top to bottom. If you need to get something to work before you have time to become a pythonolo

Re: New versions breaking extensions, etc.

2004-12-13 Thread Jive
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tcl went through this epiphany a few years, and has largely, > though not exclusively, committed to use of the once-more- > redirected API called Stubs http://wiki.tcl.tk/stubs >. > Some Tcl-ers are orgasmic about the wo

Re: Python mascot proposal

2004-12-13 Thread Jive
P.s. I never could stand Beanie and Cecil. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regexp problem, which pattern to use in split

2004-12-13 Thread Fredrik Lundh
Hans Almåsbakk wrote: > These lines are in a csv file exported from excel. > Any pointer will be greatly appreciated. Maybe I'm attacking this problem > the wrong way already from the start? (Not that I can see another way > myself :) >>> import csv http://online.effbot.org/2003_08_01_archive.h

Re: Python mascot proposal

2004-12-13 Thread Jive
I've yet to see a Python logo that I thought was really good. The cartoon green snake icon is okay, I guess, if a bit cutesy for my taste. Random thoughts: It is unreasonable to use the name "Python" and not expect people to associate it with a snake. I say that although I'm a big Python (Monte

Re: [dictionary] how to get key by item

2004-12-13 Thread Skip Montanaro
Fredrik> Skip Montanaro wrote: >> That doubles your storage Fredrik> careful: it creates another dictionary structure with the same Fredrik> size as the first one, but it doesn't copy the objects in the Fredrik> dictionary. Yes, sorry. The OP indicated the original dictionar

RegEx: find all occurances of a single character in a string

2004-12-13 Thread Franz Steinhaeusler
given a string: st="abcdatraataza" ^ ^ ^ ^ (these should be found) I want to get the positions of all single 'a' characters. (Without another 'a' neighbour) So I tried: r=re.compile('[^a]a([^a]') but this applies only for the a's, which has neighbours. So I need also '^a' and 'a$'.

Re: how do I "peek" into the next line?

2004-12-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: >I should have also said that I am using the same file handle. > So suppose the file handle is fp > then I read some lines from fp and I hand it over to other > functions that read other things from fp (in an ordered manner). another part of your program? so why not use

RE: Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Robert Brewer
Terry Reedy wrote: > "Petr Prikryl" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >Summary: In my opinion, the C-like prefix > >increment and decrement operators (++i and --i) > > You could propose to the author of Pychecker that he include, > if possible, an option to check

Re: lies about OOP

2004-12-13 Thread Stefan Seefeld
Craig Ringer wrote: On Tue, 2004-12-14 at 16:02, Mike Thompson wrote: I would pick the publication of "Design Patterns" in 1995 by the Gang of Four (Gamma, Helm, Johnson, and Vlissides), to be the herald of when "the Joy of OOP" would be "widely known." DP formalized a taxonomy for many of the h

Re: do you master list comprehensions?

2004-12-13 Thread Will Stuyvesant
Okay that was fun. Enlightening as I hoped. unroll() in Python, for arbitrary depth, _flatten in Tkinter (what else is in Tkinter!), sum() abuse. The sum(data,[]) was funniest, it works like ((['foo','bar'] + []) + ['my','your']) + ['holy','grail']. Before I think of such things I have already

Re: PyQt on MAC OS X

2004-12-13 Thread glenn andreas
In article <[EMAIL PROTECTED]>, Michael McGarry <[EMAIL PROTECTED]> wrote: > One problem is my Window created in Qt appears underneath all others on > the screen and focus never goes completely onto this window. Kind of weird. > > Any ideas? > If the application is not properly bundled you wi

Re: do you master list comprehensions?

2004-12-13 Thread Fredrik Lundh
Max M wrote: >> I tried funnies like [[w for w in L] for L in data], >> that is correct syntax, but you'd never guess. > > That is absolutely correct. It's not a funnie at all. If you find it odd it's > only because you are > not used to list comprehensiones. well, syntactically correct or not,

Re: gather information from various files efficiently

2004-12-13 Thread Keith Dart
Fredrik Lundh wrote: ... if dct.has_key(a): dct[a].append(b) else: dct[a] = [b] the drawback here is that if the number of collisions are high, you end up doing lots of extra dictionary lookups. in that case, there are better ways to do this. Sigh, this reminds me of a discussion I had at m

Re: Python mascot proposal

2004-12-13 Thread Adam DePrince
On Mon, 2004-12-13 at 14:50, James Stroud wrote: > As far as python.png below is concerned, I am reminded of the structure of > the > HIV virus: http://www.avert.org/pictures/hivstructure.htm > > Pleasing to virologists and drug companies, but as a single, computer-type > guy, it makes my skin

Re: Path problem

2004-12-13 Thread Lars Yencken
On 13/12/2004, at 6:39 PM, Binu K S wrote: sys.path[0] will contain the path to the script. From the sys module documentation: "As initialized upon program startup, the first item of this list, path[0], is the directory containing the script that was used to invoke the Python interpreter. If the sc

Re: Looking for a coder to do some work

2004-12-13 Thread Diez B. Roggisch
Have you seen freevo? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: system requirements for python 2.4

2004-12-13 Thread Dave Reed
On Monday 13 December 2004 18:17, Martin v. Löwis wrote: > ben wrote: > > I'm trying to upgrade python from 2.2 to 2.4 on a RH9 system, and can't > > find any rpm that will let me install it. > > Is FC3 required for python 2.4? > > No. However, you may have to build Python yourself. Try using the

Re: system requirements for python 2.4

2004-12-13 Thread "Martin v. Löwis"
ben wrote: I'm trying to upgrade python from 2.2 to 2.4 on a RH9 system, and can't find any rpm that will let me install it. Is FC3 required for python 2.4? No. However, you may have to build Python yourself. Try using the source RPM; if that fails to work, either correct the spec file, or build di

Re: while 1 vs while True

2004-12-13 Thread Steve Holden
Raymond Hettinger wrote: Dan Bishop wrote: Out of pure curiousity, Why wasn't 'While True' optimized also? Probably has something to do with "True" and "False" not being constants. [Nick Coghlan] Yup. Even 'None' only just became a constant in 2.4. I don't know if 'True' and 'False' are in line f

Re: Automate Python-2.4 Installs on Windows

2004-12-13 Thread Fredrik Lundh
Martin v. Löwis wrote: > I personally recommend > > http://www.python.org/2.4/msi.html > > to learn about automatic installation. which might be great if you know how things work, but is bloody confusing if you don't. most importantly, how do you set properties? a couple of larger examples woul

Re: while 1 vs while True

2004-12-13 Thread Peter Otten
Fredrik Lundh wrote: > Steve Holden wrote: > >> It was unfortunate that so many people chose to use that for >> compatibility, when if they'd used the same code that the win32all >> extensions did they could have retained backward compatibility even >> across a change to constants: >> >> try: >>

Re: PyQt on MAC OS X

2004-12-13 Thread Michael McGarry
Kevin Walzer wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I've assembled a binary installer for the native version of PyQt. See http://www.wordtech-software.com/pyqt-mac.html I built it on Panther. Not sure if it will work on Jaguar, but you're welcome to give it a try. Michael McGarry wro

Re: do you master list comprehensions?

2004-12-13 Thread Max M
Fredrik Lundh wrote: Max M wrote: I tried funnies like [[w for w in L] for L in data], That is absolutely correct. It's not a funnie at all. well, syntactically correct or not, it doesn't do what he want... Doh! *I* might not be used to list comprehensions then... You are right. That example could

Re: Looking for a coder to do some work

2004-12-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Allan Irvine <[EMAIL PROTECTED]> wrote: >HI >> >> Hope this is the right place for this, I am new. I have a spec to >create >> a (dual screen) framework application that >> >> 1 displays mp3, flash, jpegs etc. on top screen >> 2: displays buttons on bottom screen whi

Re: building extension modules under 2.4 / cygwin

2004-12-13 Thread "Martin v. Löwis"
John Hunter wrote: the procedure entry point _ctype could not be located in the dynamic link libary msvcr71.dll This sounds like a bug in the Cygwin linker or header files to me. I cannot fully check, but it seems to me that msvcr71.dll does not have a _ctype variable. Instead, the is* function

Re: how do I "peek" into the next line?

2004-12-13 Thread Adam DePrince
On Mon, 2004-12-13 at 16:24, [EMAIL PROTECTED] wrote: > OK, I am sorry , I did not explain my problem completely. > I can easily break from the loop when I see the character in a line > that I just read; however my problem involves putting back the line I > just read since if I have seen this speci

Re: Python vs. Perl

2004-12-13 Thread Ian Bicking
Jon Perez wrote: Michael McGarry wrote: I intend to use a scripting language for GUI development and front end code for my simulations in C. I want a language that can support SQL, Sockets, File I/O, and shell interaction. In my experience, Python is definitely much more suitable than Perl for t

Re: while 1 vs while True

2004-12-13 Thread Fredrik Lundh
Steve Holden wrote: > It was unfortunate that so many people chose to use that for compatibility, > when if they'd used > the same code that the win32all extensions did they could have retained > backward compatibility > even across a change to constants: > > try: > True > except Attribute

Re: gather information from various files efficiently

2004-12-13 Thread Richie Hindle
[Keith] > Sigh, this reminds me of a discussion I had at my work once... It seems > to write optimal Python code one must understand various probabilites of > your data, and code according to the likely scenario. 8-) s/Python //g -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/

Re: RegEx: find all occurances of a single character in a string

2004-12-13 Thread Franz Steinhaeusler
On Tue, 14 Dec 2004 14:19:35 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Franz Steinhaeusler wrote: >> given a string: >> >> st="abcdatraataza" >>^ ^ ^ ^ (these should be found) >> I want to get the positions of all single 'a' characters. > >for m in re.finditer("a+", st): >if

Re: system requirements for python 2.4

2004-12-13 Thread ben
Ah, I figured I would have to resort to that. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Automate Python-2.4 Installs on Windows

2004-12-13 Thread "Martin v. Löwis"
Brad Tilley wrote: Windows users may find this of interest: http://filebox.vt.edu/users/rtilley/downloads/automatic_python_install.html It gives me a dialog 'Enter username and password for "Authentication"'. What username and password should I use? I personally recommend http://www.python.org/2.4/

Organising data within a program

2004-12-13 Thread Nick Evans
Hey all, I am currently working on a simple program (small group membership database) just to get to grips with the language (bit of a newbie here :-)) and am wondering about the best way of organising the data within the program. >From my understanding I would have something like person1 =("name"

Re: thread/queue bug

2004-12-13 Thread Steve Holden
Antoon Pardon wrote: Op 2004-12-13, Tim Peters schreef <[EMAIL PROTECTED]>: [Antoon Pardon] I don't see why starting a thread as a side effect of importing is bad thread practice. Sure python doesn't cater for it, but IMO that seems to be python failing. Obviously, it's bad practice in Python becau

Re: character encoding conversion

2004-12-13 Thread "Martin v. Löwis"
Max M wrote: A smiple way to try out different encodings in a given order: The loop is fine - although ('UTF-8', 'Latin-1', 'ASCII') is somewhat redundant. The 'ASCII' case is never considered, since Latin-1 effectively works as a catch-all encoding (as all byte sequences can be considered Latin-1

Re: system requirements for python 2.4

2004-12-13 Thread Jean Brouwers
FWIIW, we use Python 2.4 on RH8 and FC2 systems. In both cases, built from scratch, following the build instructions. /Jean Brouwers In article <[EMAIL PROTECTED]>, ben <[EMAIL PROTECTED]> wrote: > I'm trying to upgrade python from 2.2 to 2.4 on a RH9 system, and can't > find any rpm that wil

Re: character encoding conversion

2004-12-13 Thread "Martin v. Löwis"
Christian Ergh wrote: Once more, indention should be correct now, and the 128 is gone too. So, something like this? Yes, something like this. The tricky part is of, course, then the fragments which you didn't implement. Also, it might be possible to do this in a for loop, e.g. for encoding in (pag

compiling ming on win32/python 2.3

2004-12-13 Thread Jelle Feringa // EZCT / Paris
I wonder whether anyone on this list has been able to compile the ming .swf output library successfully on win32/python2.3? I have quite some trouble trying to compile these kind of libraries, maybe you could point me to a good starters tutorial on this?   Cheers,   Jelle. -- ht

Re: Why are tuples immutable?

2004-12-13 Thread Fredrik Lundh
Gerrit <[EMAIL PROTECTED]> wrote: > Apart from historical, compatibility reasons, why is > >"foo %s bar %s" % [2, 4] > > illegal? > > I could imagine that anything accepting numerical values for __getitem__ > (foo[0], foo[1], ...) or that is iterable (foo.next(), foo.next()) could > be sensibl

Re: subprocess vs. proctools

2004-12-13 Thread Keith Dart
Nick Craig-Wood wrote: Keith Dart <[EMAIL PROTECTED]> wrote: Oh, I forgot to mention that it also has a more user- and programmer-friendly ExitStatus object that processess can return. This is directly testable in Python: proc = proctools.spawn("somecommand") exitstatus = proc.wait() if exitstat

Re: RegEx: find all occurances of a single character in a string

2004-12-13 Thread Franz Steinhaeusler
On Tue, 14 Dec 2004 14:05:38 +0100, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: sorry >r=re.compile('[^a]a([^a]') r=re.compile('[^a]a[^a]') I meant. -- Franz Steinhaeusler -- http://mail.python.org/mailman/listinfo/python-list

Re: lies about OOP

2004-12-13 Thread [EMAIL PROTECTED]
Hello, Instead of copy and paste, I use functions for code reuse. I didn't see the light of OOP, yet. I use Python but never did anything with OOP. I just can't see what can be done with OOP taht can't be done with standart procedural programing. -- http://mail.python.org/mailman/listinfo/pytho

Re: Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Terry Reedy
"Petr Prikryl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Summary: In my opinion, the C-like prefix >increment and decrement operators (++i and --i) Python is not C. In Python, ++x and --x are the same as + + x and - - x are the same as +(+x) and -(-x) (as you later guessed,

Reading raw data from disc

2004-12-13 Thread Ivo Woltring
Dear Pythoneers, Is it possible to read e.g. the first 3 sectors of a disc without opening a file or somesuch? I want to bitwise read a cd-rom or other media without consulting a table of contents. Just start at track 0 and go on for x bytes. Is it possible with python and if so, please help me in

Looking for a coder to do some work

2004-12-13 Thread Allan Irvine
HI > > Hope this is the right place for this, I am new. I have a spec to create > a (dual screen) framework application that > > 1 displays mp3, flash, jpegs etc. on top screen > 2: displays buttons on bottom screen which alter image when a key is > pressed. > > The hardware is a dell pc basically,

Re: gather information from various files efficiently

2004-12-13 Thread Fredrik Lundh
Keith Dart wrote: >>> try: >>> dict[a].append(b) >>> except KeyError: >>> dict[a] = [b] the drawback here is that exceptions are relatively expensive; if the number of collisions are small, you end up throwing and catching lots of exceptions. in that case, there are better ways to do thi

Re: how do I "peek" into the next line?

2004-12-13 Thread les_ander
I should have also said that I am using the same file handle. So suppose the file handle is fp then I read some lines from fp and I hand it over to other functions that read other things from fp (in an ordered manner). les -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading raw data from disc

2004-12-13 Thread Grant Edwards
On 2004-12-13, Ivo Woltring <[EMAIL PROTECTED]> wrote: > Is it possible to read e.g. the first 3 sectors of a disc > without opening a file or somesuch? Under Linux, no. You have to open the device. > I want to bitwise read a cd-rom or other media without > consulting a table of contents. Jus

Re: how do I "peek" into the next line?

2004-12-13 Thread Adam DePrince
On Mon, 2004-12-13 at 16:44, fuzzylollipop wrote: > reads are not destructive there is nothing to "put back" becuase it is > never removed to begin with. > just change your logic and thing of about what you really need to do Not true. Character special devices in Unix Named pipes in Windows NT

Re: jython and concatenation of strings

2004-12-13 Thread Jan Gregor
Ok, thanks. I didn't think that += operator is nondestructive operation - but strings are immutable so this makes sense. On 2004-12-13, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >> I found that price of += operator on string is too high in jython. For >> example 5000 such operations took 90 se

Re: How can i send 8-bit data or binary data with pyserial?

2004-12-13 Thread Diez B. Roggisch
> i have an electronic module which only understand binary data. > i use python pyserial. > for example the module starts when 00100 8-bit binary data sent.but > pyserial sent only string data. > Can i send this binary data with pyserial or another way with python. Strings _are_ binary data.

Re: do you master list comprehensions?

2004-12-13 Thread Max M
Will Stuyvesant wrote: I tried funnies like [[w for w in L] for L in data], that is correct syntax, but you'd never guess. That is absolutely correct. It's not a funnie at all. If you find it odd it's only because you are not used to list comprehensiones. In that case you might be more comfortabl

Re: how do I "peek" into the next line?

2004-12-13 Thread Steven Bethard
[EMAIL PROTECTED] wrote: now suppose I have read the first line already. then I read the second line and notice that there is a ">" in front (my special character) then I want the put back the second line into the file or the stdin. Another possibility -- have each call to __iter__ produce the next

ANN: Python Computer Graphics Kit v2.0.0alpha1

2004-12-13 Thread Matthias Baas
The first alpha release of version 2 of the Python Computer Graphics Kit is available at http://cgkit.sourceforge.net There are still a lot of things missing, but on the other hand, there is also quite a lot that is already working and that might make the current version useful nevertheless. What

Re: how do I "peek" into the next line?

2004-12-13 Thread Steven Bethard
I wrote: ... while True: ... next = self.iter.peek() ... if not next or next.rstrip('\n') == "|": ... break ... yield self.iter.next() ... Actually, the 'not next' test is not necessary since I'm using an iterator over the file (end of fi

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Nick Coghlan
Fredrik Lundh wrote: in my original post, I said I'd say that for a typical user, "A" is a marginal improvement over "B", compared to "C". which, I thought, tried to say that for a user expecting "C", neither "A" nor "B" is good enough. Ah, OK - that makes a lot more sense than the way I r

Re: New versions breaking extensions, etc.

2004-12-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jive <[EMAIL PROTECTED]> wrote: . . . >Doesn't Microsoft have an answer for that? There are (at last count) nine >skillion ActiveX >components in the wild. Surely Microsoft didn't blast them in

Re: gather information from various files efficiently

2004-12-13 Thread Keith Dart
Kent Johnson wrote: Keith Dart wrote: try: dict[a].append(b) except KeyError: dict[a] = [b] or my favorite Python shortcut: dict.setdefault(a, []).append(b) Kent Hey, when did THAT get in there? ;-) That's nice. However, the try..except block is a useful pattern for many similiar situ

Re: do you master list comprehensions?

2004-12-13 Thread Peter Otten
Will Stuyvesant wrote: data = [['foo','bar','baz'],['my','your'],['holy','grail']] result = [] for d in data: > ... for w in d: > ...result.append(w) print result > ['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail'] > > puts all the words in a list, like I want.

Re: how do I "peek" into the next line?

2004-12-13 Thread fuzzylollipop
reads are not destructive there is nothing to "put back" becuase it is never removed to begin with. just change your logic and thing of about what you really need to do -- http://mail.python.org/mailman/listinfo/python-list

Re: how do I "peek" into the next line?

2004-12-13 Thread Steven Bethard
[EMAIL PROTECTED] wrote: now suppose I have read the first line already. then I read the second line and notice that there is a ">" in front (my special character) then I want the put back the second line into the file or the stdin. Amended iterator class example using my peekable recipe: >>> class

Re: how do I "peek" into the next line?

2004-12-13 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > now suppose I have read the first line already. > then I read the second line and notice > that there is a ">" in front (my special character) > then I want the put back the second line into the > file or the stdin. the line doesn't disappear from the file just becaus

ANN: IPython 0.6.5 is out.

2004-12-13 Thread Fernando Perez
Hi all, I'm glad to announce the release of IPython 0.6.6. IPython's homepage is at: http://ipython.scipy.org and downloads are at: http://ipython.scipy.org/dist I've provided RPMs (Py2.2 and 2.3), plus source downloads (.tar.gz and .zip). Debian, Fink and BSD packages for this version shoul

Re: while 1 vs while True

2004-12-13 Thread Nick Coghlan
Paul Rubin wrote: "Raymond Hettinger" <[EMAIL PROTECTED]> writes: It is unlike to before Py3.0. Making them constants would break the reams of compatability code: True, False = (1==1), (1!=1). I don't see why that particular statement needs to fail. The interpreter could permit assigning True=Tr

Re: Python mascot proposal

2004-12-13 Thread Graham Fawcett
Luis M. Gonzalez wrote: > Hey Dimitri, > > I completely agree with you in that Python needs once for all a cool > logo. > I like your design very much, but I have a few thoughts about it: > > 1) I think that Python's logo should reflect its power. > If we use a mascot as its image, we would be givi

Re: urllib2 and Set-Cookie with "302 Moved temporarily"

2004-12-13 Thread Eino Mäkitalo
Fredrik Lundh wrote: "Eino Mäkitalo" <[EMAIL PROTECTED]> wrote: # this is ugly Yes, but short and easy. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

do you master list comprehensions?

2004-12-13 Thread Will Stuyvesant
Here is a question about list comprehensions [lc]. The question is dumb because I can do without [lc]; but I am posing the question because I am curious. This: >>> data = [['foo','bar','baz'],['my','your'],['holy','grail']] >>> result = [] >>> for d in data: ... for w in d: ...result

Re: [dictionary] how to get key by item

2004-12-13 Thread Nick Coghlan
Ola Natvig wrote: If some keys has the same value as the item this will cause problems because keys in your result dictionary can be overwritten. Could it be a option to build the result dictionary as a dictionary with the values as the keys, and lists of keys as the value. Perhaps you need to

Re: do you master list comprehensions?

2004-12-13 Thread Diez B. Roggisch
>>> data = [['foo','bar','baz'],['my','your'],['holy','grail']] >>> [e for l in data for e in l] ['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail'] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: how do I "peek" into the next line?

2004-12-13 Thread les_ander
OK, I am sorry , I did not explain my problem completely. I can easily break from the loop when I see the character in a line that I just read; however my problem involves putting back the line I just read since if I have seen this special character, I have read one line too many. Let me illustrate

Re: Fun with Outlook and MAPI

2004-12-13 Thread Steve Holden
Chris wrote: Okay, here's the results. The good news is that the code sent the mail without any popup's. The bad news is that the sent e-mail stays in the outbox instead of the sent folder. Any suggestions? Well, only the same one I've already made, which is to look on the win32all mailing li

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Fredrik Lundh
Just wrote: > This subthread was specifically about your > > python -c "import foo.bar" arg > > suggestion. in my original post, I said I'd say that for a typical user, "A" is a marginal improvement over "B", compared to "C". which, I thought, tried to say that for a user expecting "C

Re: do you master list comprehensions?

2004-12-13 Thread Steven Bethard
Will Stuyvesant wrote: data = [['foo','bar','baz'],['my','your'],['holy','grail']] result = [] for d in data: ... for w in d: ...result.append(w) print result ['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail'] Take advantage of the fact that you can have more than one 'for' in a list

Re: New versions breaking extensions, etc.

2004-12-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >Jive wrote: >> "Martin v. Löwis" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > OTOH, people who only have VC6 just need to buy VS.NET 2003, >> > which is still available. >> >> I don't even know how to do

Re: how do I "peek" into the next line?

2004-12-13 Thread Craig Ringer
On Tue, 2004-12-14 at 03:09, [EMAIL PROTECTED] wrote: > Hi, > suppose I am reading lines from a file or stdin. > I want to just "peek" in to the next line, and if it starts > with a special character I want to break out of a for loop, > other wise I want to do readline(). Assuming there's a good r

Re: New versions breaking extensions, etc.

2004-12-13 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Jive wrote: >> Can someone explain to me why Python 2.4 on MS Windows has these backward >> compatibility problems? What am I missing? > >The problem is the Python C/API. At the moment, it exposes things >directly (like >da

Re: Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Richard Brodie
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You could propose to the author of Pychecker that he include, if possible, > an option to check for and warn about '++', '--'. It does already. -- http://mail.python.org/mailman/listinfo/python-list

Re: Read a gzip file from inside a tar file

2004-12-13 Thread Fredrik Lundh
Craig Ringer wrote: >> These are huge files. My goal is to analyze the content of the gzip >> file in the tar file without having to un gzip. If that is possible. > > As far as I know, gzip is a stream compression algorithm that can't be > decompressed in small blocks. That is, I don't think you

Re: Suggestion for "syntax error": ++i, --i

2004-12-13 Thread Pierre Barbier de Reuille
Christian Ergh a écrit : Hmm, i never liked the i++ syntax, because there is a value asignment behind it and it does not show - except the case you are already used to it. >>> i = 1 >>> i +=1 >>> i 2 I like this one better, because you see the assignment at once, it is easy to read and inuit

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Nick Coghlan
Fredrik Lundh wrote: my suggestion was to make sure that the user can type "bar arg" to start a Python program called "bar" with the argument "arg". that's trivial, on all major platforms, despite what Nick says -- and yes, you can start threads from a program named "bar". try it. The command lin

Re: Performance (pystone) of python 2.4 lower then python 2.3 ???

2004-12-13 Thread Lucas Hofman
Mark Asbach wrote: Hi Lucas, On a dual Xeon 3.0 Ghz: [...] Which shows a decrease in performance. Could this have anything to do with the fact that is is a dual processor box? Maybe. But my 3Gh P4/HT is also detected as a dual processor machine (Kernel 2.6), so it might be a general problem wit

Re: uptime for Win XP?

2004-12-13 Thread David Bolen
Andrey Ivanov <[EMAIL PROTECTED]> writes: (...) > Writting this script was harder than I initially thought due to > a lack of documentation for win32all. And I still don't know what > that bizzare_int value stands for (an error/status code?). The pywin32 documentation tends not to duplicate infor

  1   2   3   4   >