any ways to judge whether an object is initilized or not in a class

2007-03-18 Thread momobear
hi, I am puzzled about how to determine whether an object is initilized in one class, anyone could give me any instructions? here is an example code: class coffee: def boil(self): self.temp = 80 a = coffer() if a.temp > 60: print "it's boiled" in C++ language we mus

Documentation for "str()" could use some adjustment.

2007-03-18 Thread John Nagle
The Python documentation for "str" says "str([object]) : Return a string containing a nicely printable representation of an object." However, there's no mention of the fact that "str" of a Unicode string with non-ASCII characters will raise a conversion exception. The documentation (and seve

911 was a RACIST crime by YANK BASTARDS against all other NATIONS Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?

2007-03-18 Thread lemnitzer
Indeed 911 was a HEINOUS _RACIST_ CRIME by YANK BASTARDS against all other nations and EUROPEAN BASTARDS were COMPLICIT by their conspicuous silence as well as all their INTELLIGENCE AGENCIES KNEW that it was an inside job and CONTROLLED DEMOLITION. On Mar 18, 10:38 pm, [EMAIL PROTECTED] wrote: >

*POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?

2007-03-18 Thread lemnitzer
Below is a post repeated with interesting information. But the main purpose of this post is to find out how many sheeple still believe in the 911 fairy tale of 19 hijackers that was to be USED BY THE EVIL CRIMINALS TO "change the world forever" BUT IT WONT. Are we going to PERMIT some evil criminal

Re: Choosing Python

2007-03-18 Thread adaworks
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 19 Mar 2007 02:21:35 GMT, <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > >> or Ada. Java could vanish tomorrow and, with Python >> and Ruby available, no one would miss Java at all.

+++ Russia Watched 9/11 In REAL TIME on SATELLITE +++

2007-03-18 Thread lemnitzer
Anyone remember that marvelous photo of Putin when Bush visited Russia after 9/11. The most astute leader in the world, was looking at Bush into his eyes as if Bush was his adored boyfriend. It was a scene from a romance novel. It was the most hilarious photo. Indeed, Putin EXACTLY knew what 9/11 w

Re: list comprehension help

2007-03-18 Thread Shane Geiger
Since you are dealing with that much information perhaps pytables would be useful to you.http://pytables.sourceforge.net [EMAIL PROTECTED] wrote: Hi I need to process a really huge text file (4GB) and this is what i need to do. It takes for ever to complete this. I read some where that "l

Re: struct.pack returns nothing

2007-03-18 Thread Gabriel Genellina
En Mon, 19 Mar 2007 02:39:01 -0300, <[EMAIL PROTECTED]> escribió: > On Sun, Mar 18, 2007 at 10:22:32PM -0700, Alex Martelli wrote: >> <[EMAIL PROTECTED]> wrote: >> >> > import struct >> > print struck.pack ('i', 1) >> > >> > it returns a '\n'. >> > What's wrong with it??? >> > :( >> >> You're tryi

Re: struct.pack returns nothing

2007-03-18 Thread andmarti
On Sun, Mar 18, 2007 at 10:22:32PM -0700, Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > > > If I build a strict with: > > > > import struct > > print struck.pack ('i', 1) > > > > it returns a '\n'. > > What's wrong with it??? > > :( > > You're trying to print a binary string that's hardly

Re: struct.pack returns nothing

2007-03-18 Thread andmarti
On Sun, Mar 18, 2007 at 10:22:45PM -0700, [EMAIL PROTECTED] wrote: > On Mar 19, 1:12 am, [EMAIL PROTECTED] wrote: > > If I build a strict with: > > > > import struct > > print struck.pack ('i', 1) > > > > it returns a '\n'. > > What's wrong with it??? > > :( > > > > -- > > Andrés M. > > ---

Re: struct.pack returns nothing

2007-03-18 Thread AWasilenko
On Mar 19, 1:12 am, [EMAIL PROTECTED] wrote: > If I build a strict with: > > import struct > print struck.pack ('i', 1) > > it returns a '\n'. > What's wrong with it??? > :( > > -- > Andrés M. > - Looks like you spelled struct wrong in the code :) -- h

Re: struct.pack returns nothing

2007-03-18 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > If I build a strict with: > > import struct > print struck.pack ('i', 1) > > it returns a '\n'. > What's wrong with it??? > :( You're trying to print a binary string that's hardly printable as-is. Try printing its repr(...) and you'll see all the binary zeros and on

struct.pack returns nothing [2]

2007-03-18 Thread andmarti
On Mon, Mar 19, 2007 at 02:12:39AM -0300, [EMAIL PROTECTED] wrote: > If I build a strict with: Sorry, I meant script. > > import struct > print struck.pack ('i', 1) > > it returns a '\n'. > What's wrong with it??? > :( > -- Andrés M. - -- http://mai

Re: class objects, method objects, function objects

2007-03-18 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: ... > But the last part of the passage makes no sense to me: > -- > When the method object is called with an argument list, it is unpacked > again, a new argument list is constructed from the instance object and > the original argument list, and the function

struct.pack returns nothing

2007-03-18 Thread andmarti
If I build a strict with: import struct print struck.pack ('i', 1) it returns a '\n'. What's wrong with it??? :( -- Andrés M. - -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension help

2007-03-18 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > > > files (you see "huge" is really relative ;-)) on 2-4GB RAM boxes and > > > setting a big buffer (1GB or more) reduces the wall time by 30 to 50% > > > compared to the default value. BerkeleyDB should have a buffering > > Out of curiosity, wh

Re: class objects, method objects, function objects

2007-03-18 Thread Gabriel Genellina
En Mon, 19 Mar 2007 01:38:37 -0300, 7stud <[EMAIL PROTECTED]> escribió: > But the last part of the passage makes no sense to me: > -- > When the method object is called with an argument list, it is unpacked > again, a new argument list is constructed from the instance object and > the origin

Re: list comprehension help

2007-03-18 Thread [EMAIL PROTECTED]
On 3/18/07, Alex Martelli <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > On Mar 18, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > I need to process a really huge text file (4GB) and this is what i > > > need to do. It takes for ever to complete this. I re

Re: class objects, method objects, function objects

2007-03-18 Thread 7stud
Darn. I made some changes to the class and I didn't change the function object. It should be: | V function object - | def sayHi(self): | | print "Hello " + self.name| |_| --

Re: class objects, method objects, function objects

2007-03-18 Thread 7stud
Oops, here is that last sentence in context(section 9.3.4): What exactly happens when a method is called? You may have noticed that x.f() was called without an argument above, even though the function definition for f specified an argument. What happened to the argument? Surely Python

class objects, method objects, function objects

2007-03-18 Thread 7stud
Hi, I'm trying to figure out what this passage from GvR's tutorial means: --- Class definitions, like function definitions (def statements) must be executed before they have any effect When a class definition is entered, a new namespace is created... When a class definition is left norma

Re: list comprehension help

2007-03-18 Thread Alex Martelli
George Sakkis <[EMAIL PROTECTED]> wrote: > On Mar 18, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Hi > > I need to process a really huge text file (4GB) and this is what i > > need to do. It takes for ever to complete this. I read some where that > > "list comprehension" can fa

Re: 4 bytes to int

2007-03-18 Thread Gabriel Genellina
En Sun, 18 Mar 2007 23:04:44 -0300, Andres Martinelli <[EMAIL PROTECTED]> escribió: > My simple question is: > I have an array of 4 bytes, and I want to convert it to the int they > form. You can use the struct module: py> struct.unpack("i", "\x00\x00\x01\x00") (65536,) That's good if you h

Re: list comprehension help

2007-03-18 Thread [EMAIL PROTECTED]
On 18 Mar 2007 19:01:27 -0700, George Sakkis <[EMAIL PROTECTED]> wrote: > On Mar 18, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > I need to process a really huge text file (4GB) and this is what i > > need to do. It takes for ever to complete this. I read some where that > > "list c

Re: Mastering Python

2007-03-18 Thread Ben Finney
"Paul McGuire" <[EMAIL PROTECTED]> writes: > On Mar 16, 9:27 am, "BartlebyScrivener" <[EMAIL PROTECTED]> wrote: > > I think you should extract that and spend twenty minutes tidying > > it up and then publish it to the Python for Programmers page or > > make it a downloadable .pdf. > > > > http://w

Re: Mastering Python

2007-03-18 Thread Paul McGuire
On Mar 16, 9:27 am, "BartlebyScrivener" <[EMAIL PROTECTED]> wrote: > On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > > > > > Wow, are you still reading? Quit wasting time and go download a > > Python dist and get started already! > > I think you should extract that and spend twenty

Choosing Python

2007-03-18 Thread adaworks
The choice is made. The school where I teach has finally made its decision to teach Python first.For several years, we have been teaching Java first, and before that, C++. I introduced Python in one of my courses and got a lot of flak from some of the other faculty. I also introduced Ruby,

Re: * operator--as in *args?

2007-03-18 Thread Alex Martelli
Gabriel Genellina <[EMAIL PROTECTED]> wrote: ... > > As far as it goes, yes. More generally, with any iterable x, the *x > > construct in function call will pass as positional arguments exactly > > those items which (e.g.) would be printed by the loop: > > for item in x: print x > > > > [[t

Re: list comprehension help

2007-03-18 Thread George Sakkis
On Mar 18, 12:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi > I need to process a really huge text file (4GB) and this is what i > need to do. It takes for ever to complete this. I read some where that > "list comprehension" can fast up things. Can you point out how to do > it in this

4 bytes to int

2007-03-18 Thread Andres Martinelli
Hello. Im new in the list, and really new in python. My simple question is: I have an array of 4 bytes, and I want to convert it to the int they form. How do you do that? :s I've looking throw the web, but with no success. Hope you can help. Andres M. -- http://mail.python.org/mailman/listinfo

Re: * operator--as in *args?

2007-03-18 Thread Gabriel Genellina
En Sun, 18 Mar 2007 22:21:41 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > 7stud <[EMAIL PROTECTED]> wrote: > >> I played around with it a little bit, and it appears the * operator >> unpacks a list, tuple, or dictionary so that each element of the >> container gets assigned to a different

Re: * operator--as in *args?

2007-03-18 Thread Gabriel Genellina
En Sun, 18 Mar 2007 18:40:32 -0300, Dustan <[EMAIL PROTECTED]> escribió: >> I can't find any documentation for the * operator when applied in >> front of a name. Is it a pointer? > > For the *star, see apply here: > http://docs.python.org/lib/non-essential-built-in-funcs.html Also, you can rea

Re: * operator--as in *args?

2007-03-18 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > On Mar 18, 3:40 pm, "Dustan" <[EMAIL PROTECTED]> wrote: > > For example: > > aFunction(*(1,2,3)) > > is equivalent to: > > aFunction(1,2,3) > > > > That's the context I've seen it in, but written like this: > > someFunc(*args) > > I played around with it a lit

Re: * operator--as in *args?

2007-03-18 Thread 7stud
On Mar 18, 3:40 pm, "Dustan" <[EMAIL PROTECTED]> wrote: > For example: > aFunction(*(1,2,3)) > is equivalent to: > aFunction(1,2,3) > That's the context I've seen it in, but written like this: someFunc(*args) I played around with it a little bit, and it appears the * operator unpacks a list, tup

Re: [Edu-sig] minimum age to learn python (a.k.a graphical vs text languages)

2007-03-18 Thread Peter Chase
I used to judge science fairs in the DC area. There were junior and senior divisions, and the junior division age range was from 6th to 9th grades. At the time I got the occasional project written in Basic, many of which were very interesting. I would think that Python would easily outclass

Re: Private data

2007-03-18 Thread Gabriel Genellina
En Sun, 18 Mar 2007 10:21:27 -0300, Dustan <[EMAIL PROTECTED]> escribió: dis.dis(testPrivateStaticFunctionVariables) > 21 0 LOAD_DEREF 0 (func) > 3 LOAD_DEREF 1 (internalData) > 6 LOAD_FAST0 (args) >

Re: Trying to print from inside a method

2007-03-18 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > > This would be pretty weird, but legal Python. > > Weirder and weirder, but still legal Python. > > This is usually how most of my code turns out :( I'm afraid if I ever > learn enough > to make a serious program I will be burned at the stake for such un- > py

Re: python QT or python-GTK

2007-03-18 Thread Alan Franzoni
Il Sun, 18 Mar 2007 11:55:47 -1000, Jon Van DeVries ha scritto: > Please correct me if I'm wrong, I'm a newbie. Please understand then, that both QT and GTK+ are graphic toolkits. An IDE is a totally different thing. Also, please understand that Qt3 and Qt4 exist, and they're quite different bea

Re: Trying to print from inside a method

2007-03-18 Thread AWasilenko
On Mar 18, 7:32 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Here, the message1 and message2 names are LOCAL variables of the > respective methods: each disappear as soon as its method ends. > > If you want to make them into INSTANCE attributes, so they'll stick > around for later, assign to self

Re: Renaming or Overloading In Python

2007-03-18 Thread Alex Martelli
gamename <[EMAIL PROTECTED]> wrote: > Hi, > > I'm a recent convert from TCL. One of the more powerful aspects of > TCL is the ability to rename a function at will (generally for testing > purposes). > > Example from the tcl doc: > > rename ::source ::theRealSource > set sourceCount 0 > proc ::

Re: list comprehension help

2007-03-18 Thread Alex Martelli
f<[EMAIL PROTECTED]> wrote: > I wonder whether the following be more efficient if DB was a > dictionnary: > > Splits = (line.split(' ') for line in open('file.text', 'r')) > DB = dict([(S[0], S[-1]) for S in Splits]) You'd still be doing much more splitting work (and behind-the-scene allocation

Re: list comprehension help

2007-03-18 Thread Alex Martelli
George Sakkis <[EMAIL PROTECTED]> wrote: ... > > Unless each line is huge, how exactly you split it to get the first and > > last blank-separated word is not going to matter much. > > > > Still, you should at least avoid repeating the splitting twice, that's > > pretty obviously sheer waste: so,

Re: list comprehension help

2007-03-18 Thread George Sakkis
On Mar 18, 1:40 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On 3/18/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > In <[EMAIL PROTECTED]>, Daniel Nogradi > > > wrote: > > > > >> f = open('file.txt','r') > > > >> for line in f: > > >

Re: fifo queue

2007-03-18 Thread Alex Martelli
Paul Rubin wrote: > Unless the queue is really large, just use the pop operation to get > stuff off the top of the queue. That causes O(n) operations but it > should be fast if n is small. > > class queue(list): > push = append > def pop(self): >

Re: Trying to print from inside a method

2007-03-18 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I'm still in the process of learning python via a handful of books I > bought. One book I am reading just introduced Base Class Methods. I I believe your problem may be more basic: local variables, istance attributes, and class variables, are very separate things.

Re: Grep Equivalent for Python

2007-03-18 Thread Aahz
In article <[EMAIL PROTECTED]>, tereglow <[EMAIL PROTECTED]> wrote: >On Mar 15, 1:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: >> tereglow <[EMAIL PROTECTED]> wrote: >>> >>>grep^MemTotal /proc/meminfo | awk '{print $2}' >> >> If you would indeed do that, maybe it's also worth learning something

Re: fifo queue

2007-03-18 Thread Roel Schroeven
drochom schreef: > hi, > > how would u improve this code? > > class queue: > ... I think I'd use collections.deque [1] instead of using a ring buffer as you're doing (I think) and doing a lot of manual bookkeeping. [1] http://docs.python.org/lib/deque-objects.html -- If I have been able t

Re: where function

2007-03-18 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > On Mar 18, 10:48 pm, [EMAIL PROTECTED] wrote: >> [...fine solutions to the problem as asked...] > Thank you both, a little more cumbersome than I expected, but it does > the job! Thanks! The obvious simple near-equivalent is: data = range(33,99) print data.ind

Re: where function

2007-03-18 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Is there a function in Python analogous to the "where" function in > IDL? > > x=[0,1,2,3,4,2,8,9] > print where(x=2) > > output: > [2,5] If you're doing a lot of this kind of thing, you probably want to use numpy:: >>> import numpy >>> x = numpy.array([0, 1

Re: where function

2007-03-18 Thread Shane Geiger
a = [0,1,2,3,4,2,8,9]

Re: where function

2007-03-18 Thread vorticitywolfe
On Mar 18, 10:48 pm, [EMAIL PROTECTED] wrote: > vorticitywo: > > > Is there a function in Python analogous to the "where" function in > > IDL? > > Python gives very elastic syntax, you can simply do: > > data = [0,1,2,3,4,2,8,9] > print [pos for pos, el in enumerate(data) if el==2] > > Bye, > bearo

Re: fifo queue

2007-03-18 Thread Paul Rubin
Unless the queue is really large, just use the pop operation to get stuff off the top of the queue. That causes O(n) operations but it should be fast if n is small. class queue(list): push = append def pop(self): return list.pop(self,0) should do about what you wr

Re: where function

2007-03-18 Thread drochom
On 18 Mar, 15:19, [EMAIL PROTECTED] wrote: > Is there a function in Python analogous to the "where" function in > IDL? > > x=[0,1,2,3,4,2,8,9] > print where(x=2) > > output: > [2,5] You can try this: print filter( lambda x: a[x]==2, range(len(a))) However it's not the best solution... -- http:

Re: where function

2007-03-18 Thread bearophileHUGS
vorticitywo: > Is there a function in Python analogous to the "where" function in > IDL? Python gives very elastic syntax, you can simply do: data = [0,1,2,3,4,2,8,9] print [pos for pos, el in enumerate(data) if el==2] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

fifo queue

2007-03-18 Thread drochom
hi, how would u improve this code? class queue: def __init__(self, size=8): self.space = size self.data = [None]*self.space self.head = 0 self.tail = 0 self.len = 0 def __len__(self): return self.len def push(self, x): if self.len==self.

where function

2007-03-18 Thread vorticitywolfe
Is there a function in Python analogous to the "where" function in IDL? x=[0,1,2,3,4,2,8,9] print where(x=2) output: [2,5] -- http://mail.python.org/mailman/listinfo/python-list

Trying to print from inside a method

2007-03-18 Thread AWasilenko
I'm still in the process of learning python via a handful of books I bought. One book I am reading just introduced Base Class Methods. I found that I needed more understanding on this concept and wrote a short test program using the Author's code as a vague reference. My question now really isn'

Re: Grep Equivalent for Python

2007-03-18 Thread tereglow
On Mar 15, 1:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > tereglow <[EMAIL PROTECTED]> wrote: > >... > > > server using the /proc FS. For example, in order to obtain the amount > > of physical memory on the server, I would do the following in shell: > > >grep^MemTotal /proc/meminfo | awk

Re: python QT or python-GTK

2007-03-18 Thread Phil Thompson
On Sunday 18 March 2007 9:55 pm, Jon Van DeVries wrote: > ** All the posts found in google are old. I'm assuming new improvements > have been made to both IDEs. ** > > Please correct me if I'm wrong, I'm a newbie. > > 1. Which one of them requires fewer lines to accomplish the same thing? > from w

python QT or python-GTK

2007-03-18 Thread Jon Van DeVries
** All the posts found in google are old. I'm assuming new improvements have been made to both IDEs. ** Please correct me if I'm wrong, I'm a newbie. 1. Which one of them requires fewer lines to accomplish the same thing? from what I understand QT it's just like Borland J-Builder. Meaning, you

Building several parsing modules

2007-03-18 Thread Robert Neville
Basically, I want to create a table in html, xml, or xslt; with any number of regular expressions; a script (Perl or Python) which reads each table row (regex and replacement); and performs the replacement on any file name, folder, or text file (e.g. css, php, html). For example, I often rename my

Re: * operator--as in *args?

2007-03-18 Thread Dustan
On Mar 18, 3:53 pm, "7stud" <[EMAIL PROTECTED]> wrote: > Hi, > > I can't find any documentation for the * operator when applied in > front of a name. Is it a pointer? > > What about the @ operator? > > Are there python names for these operators that would make searching > for documentation on them

Re: list comprehension help

2007-03-18 Thread cptnwillard
I wonder whether the following be more efficient if DB was a dictionnary: Splits = (line.split(' ') for line in open('file.text', 'r')) DB = dict([(S[0], S[-1]) for S in Splits]) -- http://mail.python.org/mailman/listinfo/python-list

Re: cheese shop: tagging and dating

2007-03-18 Thread Richard Jones
Jorge Godoy wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> The first thing I look at when examining a module is how often it is >> updated. Unfortunately, the entries there dont show this. Eg: >> >> http://www.python.org/pypi/PySimpleXML/1.0 >> >> Second, it seems that tagging is mor

* operator--as in *args?

2007-03-18 Thread 7stud
Hi, I can't find any documentation for the * operator when applied in front of a name. Is it a pointer? What about the @ operator? Are there python names for these operators that would make searching for documentation on them more fruitful? Thanks -- http://mail.python.org/mailman/listinfo/p

Re: Webcams and python

2007-03-18 Thread sturlamolden
On Mar 18, 8:01 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > I haven't been able to find the win32api extension, but i've read on > the web that time.sleep() calls win32api.Sleep(). I tested VideoCapture using PyGame to draw the graphics. PyGame wraps SDL which uses DirectDraw on Windows. I don't t

Re: lock problem

2007-03-18 Thread Leo Kislov
On Mar 16, 3:08 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Leo Kislov wrote: > > But you miss the fact that there is only one environment per process. > > Maybe there's a confusion. > The environment variable that I'm setting has noting to do with ldapsearch. I > use the environment variabl

Re: Stuck with pyqt: can't get/read button IDs from a qbuttongroup

2007-03-18 Thread raacampbell
> which translates to this in the .py: > def getNumber(self,a0): > self.listBox1.insertItem(str(id)) > As is typically the way with these things, I've just solved it. I changed the text in the file generated by pyui. It now reads: def getNumber(self,a0): self.listBox1.ins

Stuck with pyqt: can't get/read button IDs from a qbuttongroup

2007-03-18 Thread raacampbell
Hi, I'm learning Python and QT and have set myself the task of writing a simple calculator applet. I'm using Qt3 and with the designer have made a button group which contains 10 buttons to allow the user to press the digits 0 to 9. The idea is that the button group is associated with a single slo

Re: getopt or optparse options/arguments wrapping?

2007-03-18 Thread Steven Bethard
Rocky Zhou wrote: > .dirs .files is just a snapshot of the current directories, which can > be used to delete-outdated files when restoring. Here I used absolute > path by using tar's -P parameter. When fs_rstore, it will do this: > command = "tar -xpz -P -f %s.tgz -T %s" % (archive, self.t_files)

Re: Renaming or Overloading In Python

2007-03-18 Thread Paul McGuire
On Mar 18, 2:17 pm, "gamename" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm a recent convert from TCL. One of the more powerful aspects of > TCL is the ability to rename a function at will (generally for testing > purposes). > > Example from the tcl doc: > > rename ::source ::theRealSource > set sourc

Re: Renaming or Overloading In Python

2007-03-18 Thread Diez B. Roggisch
gamename schrieb: > Hi, > > I'm a recent convert from TCL. One of the more powerful aspects of > TCL is the ability to rename a function at will (generally for testing > purposes). > > Example from the tcl doc: > > rename ::source ::theRealSource > set sourceCount 0 > proc ::source args { >

Re: Optimization problem

2007-03-18 Thread mkPyVS
I would suggest taking a look at the python package networkx. It is a wonderfully created path optimization and presentation package which has a fair amount of extensabilty. Basic lowest cost path solutions should be able to solve your algorithmic needs here in polynomial time (Typically N**P time

Renaming or Overloading In Python

2007-03-18 Thread gamename
Hi, I'm a recent convert from TCL. One of the more powerful aspects of TCL is the ability to rename a function at will (generally for testing purposes). Example from the tcl doc: rename ::source ::theRealSource set sourceCount 0 proc ::source args { global sourceCount puts "called sourc

Re: Webcams and python

2007-03-18 Thread Synt4x
On 18 mar, 14:17, "sturlamolden" <[EMAIL PROTECTED]> wrote: > On Mar 18, 3:41 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > > > The problem with adding a sleep() instrucction is that the "video > > feed" looks lagged, if you know what I mean. It looks interrupted. > > You could try win32api.Sleep(0) in

Re: How to get the previous line in a file?

2007-03-18 Thread Mel Wilson
Qilong Ren wrote: > Hi, Shane, > > Thanks for fast reply. > > What I used is : >for line in open(FILE): > > I don't want to store all lines in a list because sometimes the file is very > large. We need to store the value of the previous line in a variable. Is that > right?

Re: Webcams and python

2007-03-18 Thread sturlamolden
On Mar 18, 3:41 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > The problem with adding a sleep() instrucction is that the "video > feed" looks lagged, if you know what I mean. It looks interrupted. You could try win32api.Sleep(0) instead, which will release the reminder of the time slice. -- http://

Re: Eureka moments in Python

2007-03-18 Thread Mohammad Tayseer
> I'd be interested in hearing people's stories of Eureka moments > in Python, moments where you suddenly realise that some task > which seemed like it would be hard work was easy with Python. I had a project in the faculty where we were supposed to implement a compiler for a very simple lang

Optimization problem

2007-03-18 Thread cesco
I have a set of N blocks of different lengths. The length of each block is a multiple of a basic unit. The blocks, once lined up, make a path of distance equal to R. Let's say we have 5 blocks with the following lengths: N_set_lengths = (1, 3, 2, 1, 3), then the path we cover by lining them up is e

Re: encoding - arabic(IBM 864) to UNICODE

2007-03-18 Thread Mohammad Tayseer
text_864 = "\xd1" unicode_string = unicode(text_864, encoding="cp864") # cp864 = IBM 864 The above code is working with Python 2.4. Unfortunately, it doesn't support IBM 420 & Nafitha. The mapping between IBM 864 and unicode is in Lib/encodings & the file is very simple. You can add your own ea

Re: list comprehension help

2007-03-18 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 3/18/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > In <[EMAIL PROTECTED]>, Daniel Nogradi > > wrote: > > > > >> f = open('file.txt','r') > > >> for line in f: > > >> db[line.split(' ')[0]] = line.split(' ')[-1] > > >>

Re: Still the __new__ hell ...

2007-03-18 Thread Paulo da Silva
Arnaud Delobelle escreveu: > On Mar 17, 11:48 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Arnaud Delobelle escreveu:> On Mar 17, 9:31 pm, Paulo da Silva <[EMAIL >> PROTECTED]> wrote: > > [snip] > >> Thanks. This works exactly the way you wrote. >> Yet I am misunderstanding something. Can't

Re: Finding the insertion point in a list

2007-03-18 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > On Mar 18, 2:23 am, Paul Rubin wrote: > > Steve Holden <[EMAIL PROTECTED]> writes: > > > >max(i for i,t in enumerate(x) if t <= y) > > > > Those are actually pretty direct. > > > > > How about a solution (like the bisect one suggest

Re: Finding the insertion point in a list

2007-03-18 Thread 7stud
On Mar 18, 2:23 am, Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > >max(i for i,t in enumerate(x) if t <= y) > > > Those are actually pretty direct. > > > How about a solution (like the bisect one suggested almost as soon as > > this thread started)

Re: list comprehension help

2007-03-18 Thread Daniel Nogradi
> > > I need to process a really huge text file (4GB) and this is what i > > > "list comprehension" can fast up things. Can you point out how to do > > > f = open('file.txt','r') > > > for line in f: > > > db[line.split(' ')[0]] = line.split(' ')[-1] > > > db.sync() > > > > What is

Re: list comprehension help

2007-03-18 Thread [EMAIL PROTECTED]
On 3/18/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Daniel Nogradi > wrote: > > >> f = open('file.txt','r') > >> for line in f: > >> db[line.split(' ')[0]] = line.split(' ')[-1] > >> db.sync() > > > > What is db here? Looks like a dictionary but

Re: list comprehension help

2007-03-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Daniel Nogradi wrote: >> f = open('file.txt','r') >> for line in f: >> db[line.split(' ')[0]] = line.split(' ')[-1] >> db.sync() > > What is db here? Looks like a dictionary but that doesn't have a sync method. Shelves (`shelve` module) have this API. And

Re: list comprehension help

2007-03-18 Thread [EMAIL PROTECTED]
On 3/18/07, Daniel Nogradi <[EMAIL PROTECTED]> wrote: > > I need to process a really huge text file (4GB) and this is what i > > "list comprehension" can fast up things. Can you point out how to do > > f = open('file.txt','r') > > for line in f: > > db[line.split(' ')[0]] = line.split(' ')[

Re: list comprehension help

2007-03-18 Thread Daniel Nogradi
> I need to process a really huge text file (4GB) and this is what i > need to do. It takes for ever to complete this. I read some where that > "list comprehension" can fast up things. Can you point out how to do > it in this case? > thanks a lot! > > > f = open('file.txt','r') > for line in f: >

Re: screen size/resolution in win32 in python

2007-03-18 Thread Tim Golden
adri80386 wrote: > Hi: > > How I can get the current screen resolution settings (screen.width and > screen.heigth in pixels) in python. You want the GetSystemMetrics function from the pywin32 packge: from win32api import GetSystemMetrics print "width =", GetSystemMetrics (0) print "height =",Ge

Re: list comprehension help

2007-03-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I need to process a really huge text file (4GB) and this is what i > need to do. It takes for ever to complete this. I read some where that > "list comprehension" can fast up things. Can you point out how to do > it in this case? No way I can see

pyCairo

2007-03-18 Thread Jim
I'd like to experiment with pyCairo, but I'm having installation problems. I've downloaded cairo 1.4.0, libpng 1.2.8, zlib 1.2.3, and pycairo 1.4.0, and I've placed the DLLs for cairo, libpng, and zlib in c:\python25\dlls\. However, when I run "setup.py install" I get an error message saying that

list comprehension help

2007-03-18 Thread [EMAIL PROTECTED]
Hi I need to process a really huge text file (4GB) and this is what i need to do. It takes for ever to complete this. I read some where that "list comprehension" can fast up things. Can you point out how to do it in this case? thanks a lot! f = open('file.txt','r') for line in f: db[line.

Re: XML based programming language

2007-03-18 Thread Diez B. Roggisch
stefaan schrieb: > Hello, > > I have recently had to deal with an XML-based > programming language. (The programs are > generated programmatically.) > > XML leads to a "two-level" parsing problem: first > parse the xml into tokens, then parse the tokens > to grasp their meaning (based on the sema

XML based programming language

2007-03-18 Thread stefaan
Hello, I have recently had to deal with an XML-based programming language. (The programs are generated programmatically.) XML leads to a "two-level" parsing problem: first parse the xml into tokens, then parse the tokens to grasp their meaning (based on the semantics of the programming language).

Re: GCC 4.1.2 installer for Python distutils compilation

2007-03-18 Thread Giovanni Bajo
On 18/03/2007 13.24, David Rushby wrote: > Even though I have access to MSVC 7.1, so I don't really need MinGW > myself, [...] But remember that GCC 4.1.2 is almost 4 years newer than MSVC 7.1, and I found it to produce more optimized code (especially for C++). Since it's a free alternative, it

Re: Webcams and python

2007-03-18 Thread Synt4x
On 18 mar, 04:24, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Synt4x wrote: > > from VideoCapture import Device > > cam = Device() > > > while 1: > > img = cam.getImage() > > > Now, by doing this, my processor fires up to 100% load, which > > obviously makes my

Re: cannot start IDLE in WinXP

2007-03-18 Thread imx
On 3月18日, 下午5时47分, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 17 Mar 2007 08:09:16 -0300, imx <[EMAIL PROTECTED]> escribió: > > > Enviroment: WinXP sp2, python 2.5 > > problem: click IDLE using shorcut menu or run phthonw.exe directly, > > nothing happen! But running python.exe from t

Re: Mastering Python

2007-03-18 Thread Aahz
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: >Alex Martelli wrote: >> Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >>> >>>Mastery and quickly are opposing terms Took me 15 years on a job >>>using FORTRAN 77 and I still wouldn't have called myself a master. (I'm >>>more of

Re: IDE for wxPython

2007-03-18 Thread Stef Mientki
Ghirai wrote: > Hello python-list, > > Can anyone suggest an IDE for wxPython? > Or an IDE for TkInter? > > Thanks. > on this site, you can test which GUI is best suited for your needs http://www.awaretek.com/toolkits.html I think it might be PyhtonCard -- cheers, Stef Mientki http://pic.flapp

  1   2   >