readline, rlcompleter

2005-01-10 Thread michele . simionato
This a case where the documentation is lacking. The standard library documentation (http://www.python.org/dev/doc/devel/lib/module-rlcompleter.html) gives this example try: import readline except ImportError: print "Module readline not available." else: import rlcompleter readline.parse_and_bind("t

Re: Port blocking

2005-01-10 Thread Ville Vainio
> "Steve" == Steve Holden <[EMAIL PROTECTED]> writes: >> >>> Usually you wouldn't run a public corba or pyro service over >> >>> the internet. You'd use something like XMLRPC over HTTP port >> >>> 80 partly for the precise purpose of not getting blocked by >> >>> firewalls.

stretching a string over several lines (Re: PyChecker messages)

2005-01-10 Thread Steven Bethard
Frans Englich wrote: Also, another newbie question: How does one make a string stretch over several lines in the source code? Is this the proper way? (1) print "asda asda asda asda asda asda " \ "asda asda asda asda asda asda " \ "asda asda asda asda asda asda" A couple of other op

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

2005-01-10 Thread Bengt Richter
On Tue, 11 Jan 2005 07:27:42 +1100, Tim Churches <[EMAIL PROTECTED]> wrote: >Josiah Carlson wrote: >> QOTW: Jim Fulton: "[What's] duck typing?" >> Andrew Koenig: "That's the Australian pronunciation of 'duct taping'." > >I must protest. >1) No (true-blue) Australian has every uttered the words 'd

Re: Python3: on removing map, reduce, filter

2005-01-10 Thread Steven Bethard
David M. Cooke wrote: Steven Bethard <[EMAIL PROTECTED]> writes: Some timings to verify this: $ python -m timeit -s "def square(x): return x*x" "map(square, range(1000))" 1000 loops, best of 3: 693 usec per loop $ python -m timeit -s "[x*x for x in range(1000)]" 1000 loops, best of 3: 0.0505 us

Re: reference or pointer to some object?

2005-01-10 Thread Paul Rubin
Torsten Mohr <[EMAIL PROTECTED]> writes: > i'd like to pass a reference or a pointer to an object > to a function. The function should then change the > object and the changes should be visible in the calling > function. Normally you would pass a class instance or boxed object, and let the functi

reference or pointer to some object?

2005-01-10 Thread Torsten Mohr
Hi, i'd like to pass a reference or a pointer to an object to a function. The function should then change the object and the changes should be visible in the calling function. In perl this would be something like: sub func { $ref = shift; $$ref += 123; # change } $a = 1; func(\$a); is so

Re: shutil.move has a mind of its own

2005-01-10 Thread drs
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Daniel Bickett wrote: > > shutil.move( "C:\omg.txt" , "C:\folder\subdir" ) ^ ^^ ^ > The problem is that backslash is the escape character. In particular, > '\f' is

Re: exceptions and items in a list

2005-01-10 Thread vincent wehren
Steve Holden wrote: vincent wehren wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and cont

PyChecker messages

2005-01-10 Thread Frans Englich
Hello, I take PyChecker partly as an recommender of good coding practice, but I cannot make sense of some of the messages. For example: runner.py:878: Function (main) has too many lines (201) What does this mean? Cannot functions be large? Or is it simply an advice that functions should be sm

Re: unicode mystery

2005-01-10 Thread John Lenton
On Mon, Jan 10, 2005 at 07:48:44PM -0800, Sean McIlroy wrote: > I recently found out that unicode("\347", "iso-8859-1") is the > lowercase c-with-cedilla, so I set out to round up the unicode numbers > of the extra characters you need for French, and I found them all just > fine EXCEPT for the o-e

RE: shutil.move has a mind of its own

2005-01-10 Thread Delaney, Timothy C (Timothy)
Daniel Bickett wrote: > shutil.move( "C:\omg.txt" , "C:\folder\subdir" ) ^ ^^ ^ The problem is that backslash is the escape character. In particular, '\f' is a form feed. >>> '\o' '\\o' >>> '\f' '\x0c' >>> '\s' '\\s' Notice how for '\o' and '\s' it doub

Re: OT: MoinMoin and Mediawiki?

2005-01-10 Thread Paul Rubin
Brion Vibber <[EMAIL PROTECTED]> writes: > MediaWiki should run with PHP configured in CGI handler mode, but > these days mod_php has got its claws just about everywhere anyway. If > you control your own server and don't have multi-user security > worries, mod_php is simple enough to install and wi

Re: OT: MoinMoin and Mediawiki?

2005-01-10 Thread Eric Pederson
Paul Rubin wrote: > What I'm getting at is I might like to install MoinMoin now and > migrate to Mediawiki sometime later. Anyone have any thoughts about > whether that's a crazy plan? Disclaimer, I am neither using Moinmoin nor Mediawiki, and don't really have your answer. >From what I rea

Re: OT: MoinMoin and Mediawiki?

2005-01-10 Thread Brion Vibber
Paul Rubin wrote: Mediawiki is written in PHP and is far more complex than MoinMoin, plus it's database backed, meaning you have to run an SQL server as well as the wiki software itself (MoinMoin just uses the file system). Plus, I'll guess that it really needs mod_php, while MoinMoin runs tolerab

Re: fetching method names from a class, and the parameter list from a method

2005-01-10 Thread John Lenton
On Mon, Jan 10, 2005 at 08:29:40PM +0100, Philippe C. Martin wrote: > Is this possible ? > > I am trying to have auto-completion working in a shell I wrote but I > currently have the method lists done by hand (ie; if I add/subtract a > method from that class, then my auto-completion is out of date

shutil.move has a mind of its own

2005-01-10 Thread Daniel Bickett
Hello, I'm writing an application in my pastime that moves files around to achieve various ends -- the specifics aren't particularly important. The shutil module was chosen as the means simply because that is what google and chm searches returned most often. My problem has to do with shutil.move

Re: Python3: on removing map, reduce, filter

2005-01-10 Thread David M. Cooke
Steven Bethard <[EMAIL PROTECTED]> writes: > Some timings to verify this: > > $ python -m timeit -s "def square(x): return x*x" "map(square, range(1000))" > 1000 loops, best of 3: 693 usec per loop > > $ python -m timeit -s "[x*x for x in range(1000)]" > 1000 loops, best of 3: 0.0505 usec per l

Re: why not datetime.strptime() ?

2005-01-10 Thread David M. Cooke
Joshua Spoerri <[EMAIL PROTECTED]> writes: > Skip Montanaro pobox.com> writes: >> josh> Shouldn't datetime have strptime? >> If someone wants to get their feet wet with extension module >> programming >> this might be a good place to start. Mostly, I think nobody who has >> needed/wanted it so f

unicode mystery

2005-01-10 Thread Sean McIlroy
I recently found out that unicode("\347", "iso-8859-1") is the lowercase c-with-cedilla, so I set out to round up the unicode numbers of the extra characters you need for French, and I found them all just fine EXCEPT for the o-e ligature (oeuvre, etc). I examined the unicode characters from 0 to 90

Re: Writing huve ge Sets() to disk

2005-01-10 Thread Mike C. Fletcher
Martin MOKREJÅ wrote: Tim Peters wrote: ... I was really hoping I'll get an answer how to alter the indexes for dictionaries in python. Sorry, I don't have a guess for what that might mean. I'm not an expert, mysql for example givs you ability to index say first 10 characters of a text column, w

Re: Old Paranoia Game in Python

2005-01-10 Thread SPK
You can download the code from the web directly now at: http://homepage.mac.com/spkane/python/ Thanks for all the code suggestions. This is what I was hoping for, but was honestly suprised to actually get it all, although I did get at least one emotional blast, so I don't feel like Usenet has com

OT: MoinMoin and Mediawiki?

2005-01-10 Thread Paul Rubin
I need to set up a wiki for a small group. I've played with MoinMoin a little bit and it's reasonably straightforward to set up, but limited in capabilities and uses BogusMarkupConventions. I want to use it anyway because I need something running right away and I don't want to spend a whole lot o

fetching method names from a class, and the parameter list from a method

2005-01-10 Thread Philippe C. Martin
Is this possible ? I am trying to have auto-completion working in a shell I wrote but I currently have the method lists done by hand (ie; if I add/subtract a method from that class, then my auto-completion is out of date). Same issue with method parameters. I have parsed through many of the attr

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
[Istvan Albert] > #- I think that you need to first understand how dictionaries work. > #- The time needed to insert a key is independent of > #- the number of values in the dictionary. [Batista, Facundo] > Are you sure? > > I think that is true while the hashes don't collide. If you have co

Re: Securing a future for anonymous functions in Python

2005-01-10 Thread Tim Peters
... [Anna] >> BTW - I am *quite* happy with the proposal for "where:" syntax - I >> think it handles the problems I have with lambda quite handily. [Steve Holden] > Whereas I find it to be an excrescence, proving (I suppose) that one > man's meat is another person's poison, or something. I've be

Re: why not datetime.strptime() ?

2005-01-10 Thread Joshua Spoerri
Skip Montanaro pobox.com> writes: > josh> Shouldn't datetime have strptime? > If someone wants to get their feet wet with extension module > programming > this might be a good place to start. Mostly, I think nobody who has > needed/wanted it so far has the round tuits available to spend on the >

Re: Port blocking

2005-01-10 Thread Aldo Cortesi
Thus spake Steve Holden ([EMAIL PROTECTED]): > I teach the odd security class, and what you say is far > from true. As long as the service is located behind a > firewall which opens up the correct holes for it, it's > most unlikely that corporate firewalls would disallow > client connections to su

Dabo 0.3 Released

2005-01-10 Thread Ed Leafe
We are pleased to announce Dabo 0.3, the third major release of our data application framework. The Dabo framework is a true 3-tier design, with data access and UI code separated from your business logic. And since it's Python, and uses wxPython for its UI, it is completely cross-platform, havi

Re: Writing huve ge Sets() to disk

2005-01-10 Thread Martin MOKREJÅ
Tim Peters wrote: [Tim Peters] As I mentioned before, if you store keys in sorted text files, you can do intersection and difference very efficiently just by using the Unix `comm` utiltity. [Martin MOKREJÅ] Now I got your point. I understand the comm(1) is written in C, but it still has to scan fi

Re: Chicago Python Users Group: Thu 13 Jan Meeting

2005-01-10 Thread Steve Holden
Ian Bicking wrote: The Chicago Python User Group, ChiPy, will have its next meeting on Thursday, 13 January 2005, starting at 7pm. For more information on ChiPy see http://chipy.org [...] About ChiPy --- We meet once a month, on the second Thursday of the month. If you can't come this mon

Re: Port blocking

2005-01-10 Thread Ed Leafe
On Jan 10, 2005, at 8:00 PM, Steve Holden wrote: Ah yes, but is there really? For example, I did a search of the TOC of GTK+ Reference Manual: http://developer.gnome.org/doc/API/2.0/gtk/index.html for the word "data", and there's apparently no widget which is explicitly tied to databases. So in G

Re: exceptions and items in a list

2005-01-10 Thread Steve Holden
vincent wehren wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other

Re: Writing huge Sets() to disk

2005-01-10 Thread Paul Rubin
=?windows-1252?Q?Martin_MOKREJ=8A?= <[EMAIL PROTECTED]> writes: > Yes, I'm. I still don't get what that acronym CLRS stands for ... :( CLRS = the names of the authors, Cormen, Leiserson, Rivest, and Stein, if I spelled those correctly. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Port blocking

2005-01-10 Thread Paul Rubin
Mark Carter <[EMAIL PROTECTED]> writes: > >>Also, is there a good tool for writing database UIs? > > Yes, quite a few. > > Ah yes, but is there really? For example, I did a search of the TOC of > GTK+ Reference Manual: Try looking on freshmeat or sourceforge instead. -- http://mail.python.org/ma

Re: Port blocking

2005-01-10 Thread Steve Holden
Ville Vainio wrote: "Mark" == Mark Carter <[EMAIL PROTECTED]> writes: Mark> Mark Carter wrote: >> Paul Rubin wrote: >>> Usually you wouldn't run a public corba or pyro service over >>> the internet. You'd use something like XMLRPC over HTTP port >>> 80 partly for the precise p

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJŠ
Paul Rubin wrote: Paul Rubin writes: handle with builtin Python operations without putting some thought into algorithms and data structures. From "ribosome" I'm guessing you're doing computational biology. If you're going to be writing Well, trying sort of ... Not much

Re: Port blocking

2005-01-10 Thread Steve Holden
Mark Carter wrote: Paul Rubin wrote: Mark Carter <[EMAIL PROTECTED]> writes: Supposing I decide to write a server-side application using something like corba or pyro. Usually you wouldn't run a public corba or pyro service over the internet. You'd use something like XMLRPC over HTTP port 80 partl

Re: python3: 'where' keyword

2005-01-10 Thread Steve Holden
Paul Rubin wrote: "Carl Banks" <[EMAIL PROTECTED]> writes: When I asked you to do this, it was just a rhetorical way to tell you that I didn't intend to play this game. It's plain as day you're trying to get me to admit something. I'm not falling for it. If you have a point to make, why don't you

Re: Securing a future for anonymous functions in Python

2005-01-10 Thread Steve Holden
Anna wrote: You cut something from that... """It's not, after all, the word "lambda" itself; I would still have some issues with using, say "function", instead of "lambda", but at least then I would immediately know what I was looking at...""" I would have fewer ambiguities about using, say "func"

Re: Writing huge Sets() to disk

2005-01-10 Thread Paul Rubin
Paul Rubin writes: > handle with builtin Python operations without putting some thought > into algorithms and data structures. From "ribosome" I'm guessing > you're doing computational biology. If you're going to be writing > code for these kinds of problems on a regula

Re: Python & unicode

2005-01-10 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi ! >>> and plain Latin letters But not all letters (no : é à ç à ê ö ñ etc.) Therefore, the Python's support of Unicode is... limited. Good night -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: exceptions and items in a list

2005-01-10 Thread Peter Hansen
rbt wrote: Andrey Tatarinov wrote: # skip bad object and continue with others for object in objects: try: #do something to object except Exception: pass Thanks Andrey. That's a great example of how to do it. Actually, it's not really a "great" example, since it catches _all_

Re: Writing huge Sets() to disk

2005-01-10 Thread Paul Rubin
Martin MOKREJ¦ <[EMAIL PROTECTED]> writes: > >> I have sets.Set() objects having up to 20E20 items, > just imagine, you want to compare how many words are in English, German, > Czech, Polish disctionary. You collect words from every language and record > them in dict or Set, as you wish. > >

Re: Writing huge Sets() to disk

2005-01-10 Thread John Lenton
On Tue, Jan 11, 2005 at 12:33:42AM +0200, Simo Melenius wrote: > "John Lenton" <[EMAIL PROTECTED]> writes: > > > you probably want to look into building set-like objects ontop of > > tries, given the homogeneity of your language. You should see > > imrpovements both in size and speed. > > Ternary

Re: Python Operating System???

2005-01-10 Thread Paul Rubin
"Roose" <[EMAIL PROTECTED]> writes: > Well, then of course you know I have to say: An OS does not run inside a > browser. There's a sentence I never thought I'd utter in my lifetime. > > So that is an irrelevant example, since it obviously isn't a task scheduler > in the context of this thread.

Re: time module precision

2005-01-10 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Peter Hansen wrote: _Why_ do you want to wait such brief amounts of time? What I am trying to do is sending binary data to a serial port. Since the device attached to the port cannot handle a continous in-flow of data, I need to make an artificial tiny delay in-between data

Re: Writing huge Sets() to disk

2005-01-10 Thread Scott David Daniels
Martin MOKREJÅ wrote: But I don't think I can use one-way hashes, as I need to reconstruct the string later. I have to study hard to get an idea what the proposed > code really does. Scott David Daniels wrote: Tim Peters wrote: Call the set of all English words E; G, C, and P similarly.

Handing a number of methods to the same child class

2005-01-10 Thread Dave Merrill
Python newb here. Say a class contains some rich attributes, each defined as a class. If an instance of the parent class recieves a call to a method belonging to one of those attributes, it should be dispatched to the corresponding child class. Somewhat silly example: class Address: def __ini

Re: complex numbers

2005-01-10 Thread It's me
For those of us that works with complex numbers, having complex number as a natively supported data type is a big advantage. Non-native add-ons are not sufficient and lead to very awkward program code. "Jürgen Exner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED]

Re: Python & unicode

2005-01-10 Thread Leif K-Brooks
John Roth wrote: It doesn't work because Python scripts must be in ASCII except for the contents of string literals. Having a function name in anything but ASCII isn't supported. To nit-pick a bit, identifiers can be in Unicode; they're simply confined to digits and plain Latin letters. -- http://

Re: Old Paranoia Game in Python

2005-01-10 Thread McBooCzech
Newbie in Python. I did copy the whole script form the web and save it as para1.py. I did download pyparsing module and save it to C:\\Python23\\Lib\\pyparsing122. I did run following script: import sys sys.path.append('C:\\Python23\\Lib\\pyparsing122') from pyparsing import * extraLineBreak = Wh

Re: static compiled python modules

2005-01-10 Thread Thomas Linden
Nick Coghlan wrote: > http://www.python.org/dev/doc/devel/api/importing.html > Take a look at the last three entries about registering builtin modules. Thanks a lot, it works! regards, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing huve ge Sets() to disk

2005-01-10 Thread Tim Peters
[Tim Peters] >> As I mentioned before, if you store keys in sorted text files, >> you can do intersection and difference very efficiently just by using >> the Unix `comm` utiltity. [Martin MOKREJÅ] > Now I got your point. I understand the comm(1) is written in C, but it still > has to scan file1 o

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJŠ
Simo Melenius wrote: "John Lenton" <[EMAIL PROTECTED]> writes: you probably want to look into building set-like objects ontop of tries, given the homogeneity of your language. You should see imrpovements both in size and speed. Ternary search trees give _much_ better space-efficiency compared to

Re: Writing huge Sets() to disk

2005-01-10 Thread Simo Melenius
"John Lenton" <[EMAIL PROTECTED]> writes: > you probably want to look into building set-like objects ontop of > tries, given the homogeneity of your language. You should see > imrpovements both in size and speed. Ternary search trees give _much_ better space-efficiency compared to tries, at the e

Re: Python & unicode

2005-01-10 Thread John Roth
It doesn't work because Python scripts must be in ASCII except for the contents of string literals. Having a function name in anything but ASCII isn't supported. John Roth "Michel Claveau - abstraction mÃta-galactique non triviale en fuite perpÃtuelle." <[EMAIL PROTECTED]> wrote in message news:[

Re: C structure in the Python extension

2005-01-10 Thread Craig Ringer
Dave win wrote: >Howdy: > When I was writting interface functions of the extending python, I >meet a question. As I using the "PyArg_ParseTuple(args,arg_type,...)" >function call, if I wanna use the personal defined argument, such as the >C structure which I made. How to make it? > >st

Python & unicode

2005-01-10 Thread Michel Claveau - abstraction mÃta-galactique non triviale en fuite perpÃtuelle.
ï Hi !If  Python is Ok with Unicode, why the next script not run ? # -*- coding: utf-8 -*-   def Ñ(toto):    return(toto*3)   aret = Ñ(4)   @-salutations-- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJÅ
Dear Scott, thatnk you for you excellent email. I also thought about using some zip() function to compress the strings first before using them as keys in a dict. But I don't think I can use one-way hashes, as I need to reconstruct the string later. I have to study hard to get an idea what the prop

Re: Referenz auf Variable an Funktion Ãbergeben?

2005-01-10 Thread "Martin v. LÃwis"
Torsten Mohr wrote: Geht sowas auch in Python? Nicht direkt. Es ist Ãblich, dass Funktionen, die Ergebnisse (RÃckgabewerte) liefern, dies mittels return tun: def vokale(string): result = [c for c in string if c in "aeiou"] return "".join(result) x = "Hallo, Welt" x = vokale(x) Falls man meh

Re: Writing huge Sets() to disk

2005-01-10 Thread Scott David Daniels
Tim Peters wrote: [Martin MOKREJÅ] just imagine, you want to compare how many words are in English, German, Czech, Polish disctionary. You collect words from every language and record them in dict or Set, as you wish. Call the set of all English words E; G, C, and P similarly. Once you have those S

[OT] Re: Old Paranoia Game in Python

2005-01-10 Thread Steven Bethard
Terry Reedy wrote: Never saw this specific game. Some suggestions on additional factoring out of duplicate code. def next_page(this_page): print "\n" if this_page == 0: page = 0 return The following elif switch can be replaced by calling a selection from a list of functions: [None,

Re: Reading Fortran binary files

2005-01-10 Thread Michael Fuhr
"drife" <[EMAIL PROTECTED]> writes: > I need to read a Fortran binary data file in Python. > The Fortran data file is organized thusly: > > nx,ny,nz,ilog_scale # Record 1 (Header) > ihour,data3D_array# Record 2 > > Where every value above is a 2 byte Int. Have you looked at the struct modul

Re: exceptions and items in a list

2005-01-10 Thread rbt
Andrey Tatarinov wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the othe

Python and Tsunami Warning Systems

2005-01-10 Thread Tim Churches
Boc Cringely's column on the need for a grassroots (seaweed roots?) tsunami warning system for the Indian Ocean (and elsewhere) makes some very good points - see http://www.pbs.org/cringely/pulpit/pulpit20041230.html In his following column ( http://www.pbs.org/cringely/pulpit/pulpit20050107.h

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJÅ
Tim Peters wrote: [Martin MOKREJÅ] ... I gave up the theoretical approach. Practically, I might need up to store maybe those 1E15 keys. We should work on our multiplication skills here . You don't have enough disk space to store 1E15 keys. If your keys were just one byte each, you would need to

RE: Writing huge Sets() to disk

2005-01-10 Thread Batista, Facundo
Title: RE: Writing huge Sets() to disk [Istvan Albert] #- I think that you need to first understand how dictionaries work. #- The time needed to insert a key is independent of #- the number of values in the dictionary. Are you sure? I think that is true while the hashes don't collide. If

Re: a new Perl/Python a day

2005-01-10 Thread Stephen Thorne
On Mon, 10 Jan 2005 18:38:14 GMT, gabriele renzi <[EMAIL PROTECTED]> wrote: > > You're joking, right? > > please consider that the message you all are asking are crossposted to > comp.lang.perl.misc and comp.lang.python, avoid the crossgroup flames :) Yuck. I'm on the python-list@python.org and

Re: exceptions and items in a list

2005-01-10 Thread vincent wehren
rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list,

Re: Old Paranoia Game in Python

2005-01-10 Thread Terry Reedy
Never saw this specific game. Some suggestions on additional factoring out of duplicate code. > def next_page(this_page): > print "\n" > if this_page == 0: > page = 0 > return The following elif switch can be replaced by calling a selection from a list of functions: [None, page1

Re: Writing huge Sets() to disk

2005-01-10 Thread John Lenton
you probably want to look into building set-like objects ontop of tries, given the homogeneity of your language. You should see imrpovements both in size and speed. -- http://mail.python.org/mailman/listinfo/python-list

Re: exceptions and items in a list

2005-01-10 Thread Andrey Tatarinov
rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list,

Re: Speed revisited

2005-01-10 Thread Andrea Griffini
On Mon, 10 Jan 2005 17:52:42 +0100, Bulba! <[EMAIL PROTECTED]> wrote: >I don't see why should deleting element from a list be O(n), while >saying L[0]='spam' when L[0] previously were, say, 's', not have the >O(n) cost, if a list in Python is just an array containing the >objects itself? > >Why s

exceptions and items in a list

2005-01-10 Thread rbt
If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list, or does it

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
[Martin MOKREJÅ] > ... > > I gave up the theoretical approach. Practically, I might need up > to store maybe those 1E15 keys. We should work on our multiplication skills here . You don't have enough disk space to store 1E15 keys. If your keys were just one byte each, you would need to have 4 th

Re: Writing huge Sets() to disk

2005-01-10 Thread Istvan Albert
Martin MOKREJÅ wrote: Istvan Albert wrote: So you say 1 million words is better to store in dictionary than in a set and use your own function to get out those unique or common words? I have said nothing even remotely like that. Fine, that's what I wanted to hear. How do you improve the algorithm?

Re: tuples vs lists

2005-01-10 Thread Bruno Desthuilliers
Antoon Pardon a écrit : Op 2005-01-08, Bruno Desthuilliers schreef <[EMAIL PROTECTED]>: worzel a écrit : I get what the difference is between a tuple and a list, but why would I ever care about the tuple's immuutability? Because, from a purely pratical POV, only an immutable object can be used as

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJÅ
Istvan Albert wrote: Martin MOKREJÅ wrote: But nevertheless, imagine 1E6 words of size 15. That's maybe 1.5GB of raw data. Will sets be appropriate you think? You started out with 20E20 then cut back to 1E15 keys now it is down to one million but you claim that these will take 1.5 GB. I gave up t

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

2005-01-10 Thread Tim Churches
Josiah Carlson wrote: QOTW: Jim Fulton: "[What's] duck typing?" Andrew Koenig: "That's the Australian pronunciation of 'duct taping'." I must protest. 1) No (true-blue) Australian has every uttered the words 'duct taping', because Aussies (and Pommies) know that the universe is held together wit

Re: Writing huge Sets() to disk

2005-01-10 Thread Istvan Albert
Martin MOKREJÅ wrote: But nevertheless, imagine 1E6 words of size 15. That's maybe 1.5GB of raw data. Will sets be appropriate you think? You started out with 20E20 then cut back to 1E15 keys now it is down to one million but you claim that these will take 1.5 GB. On my system storing 1 million wo

Re: Importing Problem on Windows

2005-01-10 Thread Grig Gheorghiu
I normall set PYTHONPATH to the parent directory of my module directory tree. If I have my module files in C:\home\mymodules and below, then I set PYTHONPATH to C:\home. This way, I can do "import mymodules" in my code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing Problem on Windows

2005-01-10 Thread brolewis
Sorry. 2.4 in both locations -- http://mail.python.org/mailman/listinfo/python-list

Referenz auf Variable an Funktion Ãbergeben?

2005-01-10 Thread Torsten Mohr
Hallo, ich mÃchte eine Funktion schreiben, der ich eine Referenz auf einen String Ãbergeben kann und die dann einige Ãnderungen am String vornimmt. In Perl wÃrde ich also ein \$string Ãbergeben und in der Funktion auf $$string zugreifen. Geht sowas auch in Python? Ich habe von "global" gelesen,

Reading Fortran binary files

2005-01-10 Thread drife
Hello, I need to read a Fortran binary data file in Python. The Fortran data file is organized thusly: nx,ny,nz,ilog_scale # Record 1 (Header) ihour,data3D_array# Record 2 Where every value above is a 2 byte Int. Further, the first record is a header containing the dimensions of the data t

RE: Uploading files

2005-01-10 Thread Robert Brewer
Peter Mott wrote: > If you upload a file using the cgi module is there any > way to discover the file name that the user submitted > as well as the file data? I've googled till I squint > but I can't find anything. Working example (for ASP, which uses BinaryRead to get the request stream): conten

Re: Importing Problem on Windows

2005-01-10 Thread Kartic
It is quite possible that in linux, you launched the python interpreter shell from the same directory you stored your parser.py and parse.py files. On windows, you probably saved the parser*.py files to some place like "my documents" and launched the python interpreter or IDLE. So, you could prob

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJÅ
Tim Peters wrote: [Martin MOKREJÅ] just imagine, you want to compare how many words are in English, German, Czech, Polish disctionary. You collect words from every language and record them in dict or Set, as you wish. Call the set of all English words E; G, C, and P similarly. Once you have those

Uploading files

2005-01-10 Thread Peter Mott
If you upload a file using the cgi module is there anyway to discover the file name that the user submitted as well as the file data? I've googled till I squint but I can't find anything. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing huge Sets() to disk

2005-01-10 Thread Tim Peters
[Martin MOKREJÅ] > just imagine, you want to compare how many words are in English, German, > Czech, Polish disctionary. You collect words from every language and record > them in dict or Set, as you wish. Call the set of all English words E; G, C, and P similarly. > Once you have those Set's o

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJŠ
Adam DePrince wrote: On Mon, 2005-01-10 at 11:11, Martin MOKREJ¦ wrote: Hi, I have sets.Set() objects having up to 20E20 items, each is composed of up to 20 characters. Keeping them in memory on !GB machine put's me quickly into swap. I don't want to use dictionary approach, as I don't see a sense

Re: Importing Problem on Windows

2005-01-10 Thread Grig Gheorghiu
What version of Python are you running on Linux vs. Windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib with unknown file names

2005-01-10 Thread rbt
Jeremy Jones wrote: rbt wrote: How can I use ftplib to retrieve files when I do not know their names? I can do this to get a listing of the directory's contents: ftp_server.retrlines('LIST') The output from this goes to the console and I can't figure out how to turn that into something I can use

Re: a new Perl/Python a day

2005-01-10 Thread gabriele renzi
Bob Smith ha scritto: Scott Bryce wrote: Xah Lee wrote: frustrated constantly by its inanities and incompetences.) I don't see what this has to do with Perl. You're joking, right? please consider that the message you all are asking are crossposted to comp.lang.perl.misc and comp.lang.python, avo

Re: Writing huge Sets() to disk

2005-01-10 Thread Martin MOKREJŠ
Robert Brewer wrote: Martin MOKREJŠ wrote: Robert Brewer wrote: Martin MOKREJŠ wrote: I have sets.Set() objects having up to 20E20 items, each is composed of up to 20 characters. Keeping them in memory on !GB machine put's me quickly into swap. I don't want to use dictionary approach, as I don't s

Re: Writing huge Sets() to disk

2005-01-10 Thread Adam DePrince
On Mon, 2005-01-10 at 11:11, Martin MOKREJ¦ wrote: > Hi, > I have sets.Set() objects having up to 20E20 items, > each is composed of up to 20 characters. Keeping > them in memory on !GB machine put's me quickly into swap. > I don't want to use dictionary approach, as I don't see a sense > to stor

Re: Securing a future for anonymous functions in Python

2005-01-10 Thread Anna
You cut something from that... """It's not, after all, the word "lambda" itself; I would still have some issues with using, say "function", instead of "lambda", but at least then I would immediately know what I was looking at...""" I would have fewer ambiguities about using, say "func" rather tha

Re: Securing a future for anonymous functions in Python

2005-01-10 Thread Anna
Same here. -- http://mail.python.org/mailman/listinfo/python-list

RE: Writing huge Sets() to disk

2005-01-10 Thread Robert Brewer
Martin MOKREJŠ wrote: > Robert Brewer wrote: > > Martin MOKREJŠ wrote: > > > >> I have sets.Set() objects having up to 20E20 items, > >>each is composed of up to 20 characters. Keeping > >>them in memory on !GB machine put's me quickly into swap. > >>I don't want to use dictionary approach, as I

Re: Python Operating System???

2005-01-10 Thread Roose
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > Are you actually going to answer any of my questions? Let's see > > this "JavaScript task scheduler" you have written! > > I wrote it at a company and can't release it. It ra

  1   2   >