Re: Class Methods Vs Any Other Callable

2008-05-15 Thread George Sakkis
On May 14, 4:38 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 14 mai, 16:30, George Sakkis <[EMAIL PROTECTED]> wrote: > > > On May 14, 10:19 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > An instance method works on the instance > > > > A Static method is basically a function

Re: [x for x in <> while <>]?

2008-05-15 Thread Terry Reedy
"urikaluzhny" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | It seems that I rather frequently need a list or iterator of the form | [x for x in <> while <>] I can think of two ways to interpret that. | And there is no one like this. | May be there is another short way to write i

Re: Install Python MySQL db module?

2008-05-15 Thread martin . laloux
search, search, it is a recurrent question for example http://groups.google.be/group/comp.lang.python/browse_thread/thread/7bef767753fe40f1/a3fd7c2dd7a50bef?hl=fr&lnk=gst&q=mysqldb+mac#a3fd7c2dd7a50bef -- http://mail.python.org/mailman/listinfo/python-list

Re: Nasty gotcha/bug in heapq.nlargest/nsmallest

2008-05-15 Thread Peter Otten
George Sakkis wrote: > I spent several hours debugging some bogus data results that turned > out to be caused by the fact that heapq.nlargest doesn't respect rich > comparisons: > > import heapq > import random > > class X(object): > def __init__(self, x): self.x=x >

Re: Class Methods Vs Any Other Callable

2008-05-15 Thread Bruno Desthuilliers
vbgunz a écrit : I remember learning closures in Python and thought it was the dumbest idea ever. Why use a closure when Python is fully object oriented? I didn't grasp the power/reason for them until I started learning JavaScript and then BAM, I understood them. Just a little while ago, I had a

Re: Class Methods Vs Any Other Callable

2008-05-15 Thread Bruno Desthuilliers
vbgunz a écrit : Instance methods make the most sense. A static method makes sense too *but* I can see how a class method not only does what a static method does but how a class method *also* gets the cls reference for free. I don't understand the last part - but I certainly agree on the "instan

Re: [x for x in <> while <>]?

2008-05-15 Thread Bruno Desthuilliers
urikaluzhny a écrit : It seems that I rather frequently need a list or iterator of the form [x for x in <> while <>] And there is no one like this. May be there is another short way to write it (not as a loop). Is there? The answer is very probably in the itertools module. -- http://mail.pytho

Re: named tuple mutability

2008-05-15 Thread Bruno Desthuilliers
Ben Finney a écrit : "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: On 14 mai, 18:20, [EMAIL PROTECTED] wrote: I'm concerned over the future of Python. Should tuples be named? Obviously not, unless they should. Clearly they should, unless not. May we agree to disagree here - unless we d

Re: Custom Classes?

2008-05-15 Thread Gabriel Genellina
En Tue, 13 May 2008 15:10:21 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: I remember why I had the number with the getpic. It is because I display several of these images on a single page, and apparently I cannot call the same script and get more than one image from an HTML page. T

Re: Recommended way to POST with cookies?

2008-05-15 Thread Laszlo Nagy
Gilles Ganault wrote: Hello According to Google, there seems to be several tools available, possibly deprecated, to download data from web pages by POSTing forms and save cookies to maintain state. I need to write a script under Windows with ActivePython 2.5.1.1 that would do this: 1.

Re: [x for x in <> while <>]?

2008-05-15 Thread Paul Rubin
urikaluzhny <[EMAIL PROTECTED]> writes: > It seems that I rather frequently need a list or iterator of the form > [x for x in <> while <>] > And there is no one like this. > May be there is another short way to write it (not as a loop). Is there? itertools.takewhile(condition, seq) -- http://mail.

Re: ?

2008-05-15 Thread urikaluzhny
On May 15, 10:06 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "urikaluzhny" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | It seems that I rather frequently need a list or iterator of the form > | [x for x in <> while <>] > > I can think of two ways to interpret that. I mean

Re: wxpython dialog - do something after ShowModal()?

2008-05-15 Thread Iain King
On May 14, 9:37 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > Iain King <[EMAIL PROTECTED]> wrote: > > > Hi. I have a modal dialog whcih has a "Browse..." button which pops > > up a file selector. This all works fine, but the first thing the user > > has

Re: cgitb performance issue

2008-05-15 Thread Gabriel Genellina
En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió: I tried adding a form to our website for uploading large files. Personally, I dislike the forms that tell yo

Making Variable Text Output More Pythonic?

2008-05-15 Thread Casey McGinty
Hi, I have some classes that print variable outputs depending on their internal state, like so: def __str__(self): out = [] if self.opt1: out += ['option 1 is %s' % self.opt1'] if self.opt2: out += ['option 2 is %s' % self.opt2'] return '\n'.join(out) Is there any way to

Re: sys.excepthack...

2008-05-15 Thread Nick Craig-Wood
David C. Ullrich <[EMAIL PROTECTED]> wrote: > Becoming a fan of wxPython, but I can't stand > what it does with error messsages [snip] > So I want to pop up a modal dialog on error. [snip] > Came up with a ridiculous hack involving both sys.stderr > and sys.excepthook. Works exactly the way I

Re: Rename field in Access DB

2008-05-15 Thread Iain King
On May 14, 4:29 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > Iain King wrote: > > I'm manipulating an MS Access db via ADODB with win32com.client. I > > want to rename a field within a table, but I don't know how to. I > > assume there is a line of SQL which will do it, but nothing I've tried > >

Re: Sanitised Newsgroup Feeds?

2008-05-15 Thread Casey McGinty
On Wed, May 14, 2008 at 7:47 PM, Paddy <[EMAIL PROTECTED]> wrote: > Hi, > Does anyone do a sanitised newsgroup feed? Something like what mail > filters do for email? > > Hi, I used to read the summary emails and had the same problem. I think

Re: create window on panel

2008-05-15 Thread Laszlo Nagy
Jimmy wrote: Hi, all I have been trying to use wxPython to design a GUI that will be displayed on the panel on the top of desktop. that is when the program starts, it will dwell on the panel to display some dynamic information. can anyone tell me in wxPython how to do this? thanks! AFAIK it

Re: [off-topic] Usenet

2008-05-15 Thread Ben Finney
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "John Salerno" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | On Wed, 14 May 2008 12:58:12 -0400 > | "Terry Reedy" <[EMAIL PROTECTED]> wrote: > | > | > gmane.comp.python.general > | > | So that's the same as c.l.p.? > > It is the sam

Re: Sanitised Newsgroup Feeds?

2008-05-15 Thread Ben Finney
Paddy <[EMAIL PROTECTED]> writes: > Does anyone do a sanitised newsgroup feed? Something like what mail > filters do for email? The feature you're looking for is called a "kill list" or "kill file": add patterns to the kill file, and matching messages will be omitted from your view of the newsgro

Re: named tuple mutability

2008-05-15 Thread Ben Finney
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > May we agree to disagree here - unless we don't ? Absolutely not, except where not applicable. -- \ "I always wanted to be somebody. I see now that I should have | `\ been more specific." -- Lily Tomlin | _

Re: "indexed properties"...

2008-05-15 Thread Gabriel Genellina
En Wed, 14 May 2008 18:15:41 -0300, David C. Ullrich <[EMAIL PROTECTED]> escribió: Having a hard time phrasing this in the form of a question... The other day I saw a thread where someone asked about overrideable properties and nobody offered the advice that properties are Bad. So maybe we've

Re: python newbie: some surprises

2008-05-15 Thread Kees Bakker
Gabriel Genellina wrote: > En Fri, 09 May 2008 10:37:30 -0300, v4vijayakumar <[EMAIL PROTECTED]> > escribió: > >> On May 9, 1:48 pm, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote: >>> v4vijayakumar a écrit : >>> >>> > When I started coding in python, these two things surprised me. >>> >>> > 1.

Re: create window on panel

2008-05-15 Thread Jimmy
On May 15, 5:54 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > Jimmy wrote: > > Hi, all > > > I have been trying to use wxPython to design a GUI that will be > > displayed on the panel on the top of desktop. that is when the > > program starts, it will dwell on the panel to display some dynamic > > i

Re: List behaviour

2008-05-15 Thread A.T.Hofkamp
On 2008-05-15, Gabriel <[EMAIL PROTECTED]> wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > tasks = [[]]*6 tasks > [[], [], [], [], [], []] tasks[0].append(1) tasks > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting to end

Re: python newbie: some surprises

2008-05-15 Thread Marco Mariani
Kees Bakker wrote: So far, I have seen only one editor that understands the difference between TABs and indentation, and that is Emacs. Oh, well... in .vimrc: autocmd FileType python set tabstop=8 autocmd FileType python set softtabstop=4 autocmd FileType python set expandtab --

Re: List behaviour

2008-05-15 Thread Gabriel
Bruno Desthuilliers websiteburo.invalid> writes: > The problem here is that your first statement > > #>>> tasks = [[]]*6 > > creates a list (task) containing 6 references to the *same* (empty) list > object. You can check this easily using the identity test operator 'is': > > If you want 6

Re: named tuple mutability

2008-05-15 Thread Bruno Desthuilliers
Ben Finney a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> writes: May we agree to disagree here - unless we don't ? Absolutely not, except where not applicable. and vice versa. -- http://mail.python.org/mailman/listinfo/python-list

Re: python newbie: some surprises

2008-05-15 Thread tinnews
Kees Bakker <[EMAIL PROTECTED]> wrote: > > So far, I have seen only one editor that understands the difference between > TABs and indentation, and that is Emacs. Most vi clones (and the original vi) do too! :-) E.g. in the clone I use (vile) there are independent settings for tabstop and shiftw

Re: List behaviour

2008-05-15 Thread Bruno Desthuilliers
Gabriel a écrit : Hi all Just wondering if someone could clarify this behaviour for me, please? tasks = [[]]*6 tasks [[], [], [], [], [], []] tasks[0].append(1) tasks [[1], [1], [1], [1], [1], [1]] Well what I was expecting to end up with was something like: >>> tasks [[1], [], [], [], []

Re: How to subclass file

2008-05-15 Thread Gabriel Genellina
En Wed, 14 May 2008 21:23:26 -0300, Yves Dorfsman <[EMAIL PROTECTED]> escribió: I want to create a subclass of 'file' but need to open the file with os.open (because I want to open it in exclusive mode), and need an additional method. Because I need an additional method, I truly need a ob

Re: List behaviour

2008-05-15 Thread bockman
On 15 Mag, 12:08, Gabriel <[EMAIL PROTECTED]> wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > > >>> tasks = [[]]*6 > >>> tasks > > [[], [], [], [], [], []]>>> tasks[0].append(1) > >>> tasks > > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting

Re: List behaviour

2008-05-15 Thread Gabriel
Diez B. Roggisch nospam.web.de> writes: > So instead of creating a list of list by the *-operator that only multiplies > the references (which is fine immutable objects like strings or numbers), > you need to explicitly create new lists, e.g. with a list-comprehension: > > tasks = [[] for _ in x

Re: List behaviour

2008-05-15 Thread Gabriel
virgilio.it> writes: > >>> tasks = [ [] for x in xrange(6) ] > >>> tasks[0].append(1) > >>> tasks > [[1], [], [], [], [], []] > >>> > Thanks, Bockman -- http://mail.python.org/mailman/listinfo/python-list

List behaviour

2008-05-15 Thread Gabriel
Hi all Just wondering if someone could clarify this behaviour for me, please? >>> tasks = [[]]*6 >>> tasks [[], [], [], [], [], []] >>> tasks[0].append(1) >>> tasks [[1], [1], [1], [1], [1], [1]] Well what I was expecting to end up with was something like: >>> tasks [[1], [], [], [], [], []]

Re: List behaviour

2008-05-15 Thread Diez B. Roggisch
Gabriel wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > tasks = [[]]*6 tasks > [[], [], [], [], [], []] tasks[0].append(1) tasks > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting to end up with was something like: > 

Re: Class Methods Vs Any Other Callable

2008-05-15 Thread Arnaud Delobelle
[EMAIL PROTECTED] wrote: > On 14 mai, 22:44, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > On 14 mai, 19:45, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > >> __new__ is a static method! > > > > > __new__ is a special-cased staticmethod tha

Re: Running an interactive interpreter inside a python

2008-05-15 Thread R. Bernstein
"Alan J. Salmoni" <[EMAIL PROTECTED]> writes: > I'm not sure if this is exactly what you're after, but try looking > into the 'code' module. > > It's fairly easy to make an interactive interpreter that runs within > your program. If you import your programs variables into > __main__.__dict__, you c

Re: create window on panel

2008-05-15 Thread Laszlo Nagy
Thanks for your reply! I am using Linux+gnome. Actually, what I want is simply a text-region on the panel and display some dynamic information on it. Is it hard to do it ? Google is your friend! I searched for "gnome python panel" and the first hit was: http://www.onlamp.com/pub/a/python

Greetings

2008-05-15 Thread castironpi
Hail, Earthlings, I have an easy request to take over the newsgroup ("Taking Over the Newsgroup", "TOTN"). May I? Pros: Lifetime benefits Google product Talking Cons: World domination No crossing Social aspect* Read the fine print: *Social: Subscribers to TOTN may come talking, tel

Re: Nasty gotcha/bug in heapq.nlargest/nsmallest

2008-05-15 Thread George Sakkis
On May 15, 3:06 am, Peter Otten <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > I spent several hours debugging some bogus data results that turned > > out to be caused by the fact that heapq.nlargest doesn't respect rich > > comparisons: > > > import heapq > > import random > > >

Re: ?

2008-05-15 Thread Geoffrey Clements
"urikaluzhny" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On May 15, 10:06 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "urikaluzhny" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | It seems that I rather frequently need a list or iterator of the form > | [x f

datamining .txt-files, library?

2008-05-15 Thread globalrev
i have a big collection of .txt files that i want to open and parse to extract information. is there a library for this or maybe even built in? -- http://mail.python.org/mailman/listinfo/python-list

Re: datamining .txt-files, library?

2008-05-15 Thread Chris
On May 15, 2:27 pm, globalrev <[EMAIL PROTECTED]> wrote: > i have a big collection of .txt files that i want to open and parse to > extract information. > > is there a library for this or maybe even built in? os.open to open the files and iterate through it and built in string functions to parse i

Re: datamining .txt-files, library?

2008-05-15 Thread George Sakkis
On May 15, 8:27 am, globalrev <[EMAIL PROTECTED]> wrote: > i have a big collection of .txt files that i want to open and parse to > extract information. > > is there a library for this or maybe even built in? This has a lot to do with how well-structured are your files and what kind of information

how to send files via bluetoot

2008-05-15 Thread sayang-87
-- http://mail.python.org/mailman/listinfo/python-list

basic comparing files

2008-05-15 Thread Beema shafreen
hi all, I have a very basic doubt I am comparing two files A and B which has three columns a1, b1 of A and a2, b2 say for example if need to compare a1 with a2 and if there are common i have display a1, b1, b2 or else i have to display a1 , b1 or a1, b2 is the set function going to be the best o

Re: datamining .txt-files, library?

2008-05-15 Thread globalrev
On 15 Maj, 14:40, George Sakkis <[EMAIL PROTECTED]> wrote: > On May 15, 8:27 am, globalrev <[EMAIL PROTECTED]> wrote: > > > i have a big collection of .txt files that i want to open and parse to > > extract information. > > > is there a library for this or maybe even built in? > > This has a lot to

no inputstream?

2008-05-15 Thread max
hey folks, coming from java, new to python. i'm trying to port a java app to python that writes an inputstream to a buffer, then parses the buffer (specifically, i'm getting ID3 tags from mp3s online). i understand that this java approach to the task may not apply to python, but i'm having troub

Re: create window on panel

2008-05-15 Thread Jimmy
On May 15, 7:45 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > Thanks for your reply! > > > I am using Linux+gnome. Actually, what I want is simply a text-region > > on the panel > > and display some dynamic information on it. Is it hard to do it ? > > Google is your friend! I searched for "gnome p

Re: datamining .txt-files, library?

2008-05-15 Thread Ville M. Vainio
Chris <[EMAIL PROTECTED]> writes: > On May 15, 2:27 pm, globalrev <[EMAIL PROTECTED]> wrote: >> i have a big collection of .txt files that i want to open and parse to >> extract information. >> >> is there a library for this or maybe even built in? > > os.open to open the files and iterate throug

send yield

2008-05-15 Thread castironpi
Why can't I write this? -- http://mail.python.org/mailman/listinfo/python-list

Re: no inputstream?

2008-05-15 Thread Marc 'BlackJack' Rintsch
On Thu, 15 May 2008 06:08:35 -0700, max wrote: > i currently have locations of the mp3s in question as strings, which > works for parsing local files, but gives me a "No such file or > directory" error when it tries to process URLs. it seems terribly > inefficient to download each mp3 just to get

Re: no inputstream?

2008-05-15 Thread castironpi
On May 15, 8:37 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 15 May 2008 06:08:35 -0700, max wrote: > > i currently have locations of the mp3s in question as strings, which > > works for parsing local files, but gives me a "No such file or > > directory" error when it tries to

Re: create window on panel

2008-05-15 Thread Laszlo Nagy
URL:http://www.daa.com.au/~james/software/pygtk/ / /It should be easy to read the docs, view the demo programs and create your own program. L thanks~ it seems attractive, however, I did not find much useful information :( http://www.pygtk.org/ -- full docs http://packages.ubuntu.com/

Re: "indexed properties"...

2008-05-15 Thread Gabriel Genellina
En Wed, 14 May 2008 18:15:41 -0300, David C. Ullrich <[EMAIL PROTECTED]> escribió: > Having a hard time phrasing this in the form > of a question... > > The other day I saw a thread where someone asked > about overrideable properties and nobody offered > the advice that properties are Bad. So may

Re: send yield

2008-05-15 Thread Max Erickson
castironpi <[EMAIL PROTECTED]> wrote: > Why can't I write this? > -- > http://mail.python.org/mailman/listinfo/python-list > > Because you don't know how? max -- http://mail.python.org/mailman/listinfo/python-list

Re: send yield

2008-05-15 Thread castironpi
On May 15, 8:32 am, castironpi <[EMAIL PROTECTED]> wrote: > Why can't I write this? It is twice one. Now: Where's My Volume? -- http://mail.python.org/mailman/listinfo/python-list

Re: no inputstream?

2008-05-15 Thread max
On May 15, 9:51 am, castironpi <[EMAIL PROTECTED]> wrote: > On May 15, 8:37 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > On Thu, 15 May 2008 06:08:35 -0700, max wrote: > > > i currently have locations of the mp3s in question as strings, which > > > works for parsing local files, bu

Re: Class Methods Vs Any Other Callable

2008-05-15 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : [EMAIL PROTECTED] wrote: On 14 mai, 22:44, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: On 14 mai, 19:45, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: __new__ is a static method! __new__ is a special-cased staticmethod

Re: send yield

2008-05-15 Thread Bruno Desthuilliers
castironpi a écrit : Why can't I write this? Because one or more of the "t", "h", "i", "s" keys are missing from your keyboard ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Running an interactive interpreter inside a python

2008-05-15 Thread castironpi
On May 15, 6:26 am, [EMAIL PROTECTED] (R. Bernstein) wrote: > "Alan J. Salmoni" <[EMAIL PROTECTED]> writes: > > > I'm not sure if this is exactly what you're after, but try looking > > into the 'code' module. > > > It's fairly easy to make an interactive interpreter that runs within > > your progra

Re: no inputstream?

2008-05-15 Thread castironpi
On May 15, 9:02 am, max <[EMAIL PROTECTED]> wrote: > On May 15, 9:51 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > > > > On May 15, 8:37 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > On Thu, 15 May 2008 06:08:35 -0700, max wrote: > > > > i currently have locations of the mp3s

Re: send yield

2008-05-15 Thread castironpi
On May 15, 9:04 am, Bruno Desthuilliers wrote: > castironpi a écrit : > > > Why can't I write this? > > Because one or more of the "t", "h", "i", "s" keys are missing from your > keyboard ? No; they're all here. -- http://mail.python.org/mailman/listinfo/python-list

ANN: Pyrex 0.9.8

2008-05-15 Thread greg
Pyrex 0.9.8 is now available: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ This version has a number of new features: * In-place operators (+= etc.) are now supported. * The Pyrex compiler now has built-in facilities for automatically tracking down and compiling all the modu

Re: send yield

2008-05-15 Thread castironpi
On May 15, 9:07 am, castironpi <[EMAIL PROTECTED]> wrote: > On May 15, 9:04 am, Bruno Desthuilliers > [EMAIL PROTECTED]> wrote: > > castironpi a écrit : > > > > Why can't I write this? > > > Because one or more of the "t", "h", "i", "s" keys are missing from your > > keyboard ? > > No; they're all

Dbase / foxpro files

2008-05-15 Thread Johny
Is there a module for reading/modifing db files from Python? Thanks for help B. -- http://mail.python.org/mailman/listinfo/python-list

Re: send yield

2008-05-15 Thread Dan Upton
On Thu, May 15, 2008 at 9:32 AM, castironpi <[EMAIL PROTECTED]> wrote: > Why can't I write this? > -- Because your antecedent is undefined? -- http://mail.python.org/mailman/listinfo/python-list

Re: datamining .txt-files, library?

2008-05-15 Thread Bruno Desthuilliers
Chris a écrit : On May 15, 2:27 pm, globalrev <[EMAIL PROTECTED]> wrote: i have a big collection of .txt files that i want to open and parse to extract information. is there a library for this or maybe even built in? os.open to open the files What's wrong with (builtin) open ? -- http://ma

Re: Dbase / foxpro files

2008-05-15 Thread Peter Otten
Johny wrote: > Is there a module for reading/modifing db files from Python? There is a recipe by Raymond Hettinger: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: send yield

2008-05-15 Thread castironpi
On May 15, 9:26 am, "Dan Upton" <[EMAIL PROTECTED]> wrote: > On Thu, May 15, 2008 at 9:32 AM, castironpi <[EMAIL PROTECTED]> wrote: > > Why can't I write this? > > -- > > Because your antecedent is undefined? Of the two ways to play, just to say #define this per se would be a bad move, but that's

Re: Custom Classes?

2008-05-15 Thread Victor Subervi
Well, you are right. It looks like one of those instances where I fixed something and did not check to see if it influenced the problem now at hand. Thanks again. Victor On 5/15/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Tue, 13 May 2008 15:10:21 -0300, Victor Subervi < > [EMAIL PROT

pyserial and file open conflict?

2008-05-15 Thread p . wallstedt
Hi all! I have a small but rather annoying problem with pyserial. I want to open a file on disk for reading and then open a com-port, write lines from the file to the port and then read something back and compare it to the next line in the file. Should be simple. And it is, apart from the fact tha

RE: no inputstream?

2008-05-15 Thread John Krukoff
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of max > Sent: Thursday, May 15, 2008 8:02 AM > To: python-list@python.org > Subject: Re: no inputstream? > > On May 15, 9:51 am, castironpi <[EMAIL PROTECTED]> wrote: > > On May 15, 8:37 am, Marc

Building python 2.5 fails on linux 64

2008-05-15 Thread Marc-André Belzile
Hi, I have the following error when building python 2.5 (revision 63261) ./Parser/asdl_c.py -c ./Python ./Parser/Python.asdl 'import site' failed; use -v for traceback Traceback (most recent call last): File "./Parser/asdl_c.py", line 7, in ? import os, sys, traceback ImportError: No modu

Problem creating a shorcut

2008-05-15 Thread Mike Driscoll
Hi, I've had this niggling issue from time to time. I want to create a shortcut on the user's desktop to a website that specifically loads Firefox even if Firefox is not the default browser. I usually use COM as it allows very specific settings of the shortcut, such as the Working Directory and t

Re: Dbase / foxpro files

2008-05-15 Thread John Machin
Johny wrote: Is there a module for reading/modifing db files from Python? Thanks for help B. I have a module -- which I'm going to get around to releasing one of these days :-) -- which allows to read dBase III, dBase IV and Foxpro files (sequentially only, not randomly) and to write dBaseIII

Re: Dbase / foxpro files

2008-05-15 Thread Johny
On May 15, 5:21 pm, John Machin <[EMAIL PROTECTED]> wrote: > Johny wrote: > > Is there a module for reading/modifing db files from Python? > > Thanks for help > > B. > > I have a module -- which I'm going to get around to releasing one of > these days :-) -- which allows to read dBase III, dBase IV

Re: List behaviour

2008-05-15 Thread Lie
On May 15, 5:08 pm, Gabriel <[EMAIL PROTECTED]> wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > > >>> tasks = [[]]*6 > >>> tasks > > [[], [], [], [], [], []]>>> tasks[0].append(1) > >>> tasks > > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecti

Re: Class Methods Vs Any Other Callable

2008-05-15 Thread Arnaud Delobelle
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > FWIW, I wonder why the BDFL choosed to implement __new__ as a > staticmethod - there are probably some pretty good reasons, but not > knowing them, it looks like __new__ would have been a perfect > candidate for a classmethod. > > So far, the only

How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
All: I've got a script that runs really slow because I'm reading from a stream a byte at a time: // TERRIBLE for y in range( height ): for color in range(4): for x in range( width ): pixelComponent = fileIO.read(4) buffer = unpack("!f",pix

exists=false, but no complaint when i open it!?

2008-05-15 Thread globalrev
print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet \trainingsetunzipped\training_set\mv_001.txt') d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- sweden.gif') d.close() exists returns false but when i open it doesnt complain. how come? another file that exists ret

Re: HASH TABLES IN PYTHON

2008-05-15 Thread Michael Torrie
Blubaugh, David A. wrote: > I was wondering if anyone has ever worked with hash tables within the > Python Programming language? I will need to utilize this ability for > quick numerical calculations. Dictionaries are, by definition, hash tables with a very optimized algorithm to minimize colli

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread Tim Golden
globalrev wrote: print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet \trainingsetunzipped\training_set\mv_001.txt') d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- sweden.gif') d.close() Ummm. These are not the same files (unless you've got some bizarre NTFS link

Re: How do I use the unpack function?

2008-05-15 Thread Gary Herron
Marlin Rowley wrote: All: I've got a script that runs really slow because I'm reading from a stream a byte at a time: // TERRIBLE for y in range( height ): for color in range(4): for x in range( width ): pixelComponent = fileIO.read(4) buffe

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread John Machin
On May 16, 2:03 am, globalrev <[EMAIL PROTECTED]> wrote: > print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet > \trainingsetunzipped\training_set\mv_001.txt') > > d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- > sweden.gif') > d.close() > > exists returns false but

RE: exists=false, but no complaint when i open it!?

2008-05-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Thursday, May 15, 2008 12:11 PM > To: globalrev; python-list@python.org > Subject: RE: exists=false, but no complaint when i open it!? > > > > > print os.path.exists('C

RE: exists=false, but no complaint when i open it!?

2008-05-15 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of globalrev > Sent: Thursday, May 15, 2008 12:04 PM > To: python-list@python.org > Subject: exists=false, but no complaint when i open it!? > > print os.path.exists('C:\Users\saftarn\Desktop\NetFl

file open/read/name etc, not working

2008-05-15 Thread globalrev
import os print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') d.readline() returns true in the shell but prints no text even though the document contains text. d.name returns nothing, d.name() raises an error. -- http://mail.pyth

Re: file open/read/name etc, not working

2008-05-15 Thread globalrev
On 15 Maj, 18:12, globalrev <[EMAIL PROTECTED]> wrote: > import os > > print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') > d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') > d.readline() > > returns true in the shell but prints no text even though the document > contains text. >

Re: cgitb performance issue

2008-05-15 Thread Ethan Furman
Gabriel Genellina wrote: En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió: I tried adding a form to our website for uploading large files. Personally, I

Re: file open/read/name etc, not working

2008-05-15 Thread John Machin
On May 16, 2:12 am, globalrev <[EMAIL PROTECTED]> wrote: > import os > > print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') > d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') Two different paths again. > d.readline() This reads one line and then does absolutely nothing with it

Re: pyserial and file open conflict?

2008-05-15 Thread Henrique Dante de Almeida
Em Thu, 15 May 2008 08:03:40 -0700, p.wallstedt escreveu: > Hi all! > > I have a small but rather annoying problem with pyserial. I want to open > a file on disk for reading and then open a com-port, write lines from > the file to the port and then read something back and compare it to the > next

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
Thanks for the advice! However, I assumed that: fourbytes = pixelComponent[:4] would shave that byte off the array in pixelComponent. So that the array is smaller by one on the next iteration. Is this not the case? I'm getting weird results now.. -M > Date: Thu, 15 May 2008 09:11:23

Re: How do I use the unpack function?

2008-05-15 Thread John Machin
On May 16, 2:11 am, Gary Herron <[EMAIL PROTECTED]> wrote: > Marlin Rowley wrote: > > All: > > > I've got a script that runs really slow because I'm reading from a > > stream a byte at a time: > > > // TERRIBLE > > for y in range( height ): > > for color in range(4): > > for x i

Re: How do I use the unpack function?

2008-05-15 Thread Gary Herron
Marlin Rowley wrote: Thanks for the advice! However, I assumed that: fourbytes = pixelComponent[:4] would shave that byte off the array in pixelComponent. So that the array is smaller by one on the next iteration. Is this not the case? You don't need the newsgroup to answer this kind of

RE: file open/read/name etc, not working

2008-05-15 Thread Andreas Tawn
>import os > >print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') >d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') >d.readline() > >returns true in the shell but prints no text even though the document >contains text. > >d.name returns nothing, d.name() raises an error. >-- >http

RE: How do I use the unpack function?

2008-05-15 Thread Marlin Rowley
Sorry Gary, I found out that I wasn't reassigning the array back once I got the first 4 bytes. I don't mean to appear lazy..:( Thanks for the help! -M > Date: Thu, 15 May 2008 09:51:22 -0700> From: [EMAIL PROTECTED]> To: [EMAIL > PROTECTED]> CC: python-list@python.org> Subject: Re: How

Re: Dbase / foxpro files

2008-05-15 Thread Claudio Driussi
Johny ha scritto: Is there a module for reading/modifing db files from Python? Thanks for help B. If your target is Windows, you can try mediator components http://www.otc.pl/download/ which are COM objects based on xHarbour and which give you full access to DBF and index. You need PythonWin

  1   2   >