Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Hi, I am trying to work out why I get UnboundLocalError when accessing an int from a function where the int is at the global scope, without explicitly declaring it as global but not when accessing a list in similar circumstances. The documentation: http://docs.python.org/ref/naming.html does not g

Running multiple versions of Python on the same host..

2006-07-09 Thread Cowmix
For my day job I am forced to run RHEL3 (and Centos3 on my desktop). I want to be able to use a few applications that require Python 2.4.X but RHEL3 ships with Python 2.2.3. I have tried to install and upgrade Python 2.4.X many ways like using PyVault and doing a source based install but each way h

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Frank Millman
Paddy wrote: > Hi, > I am trying to work out why I get UnboundLocalError when accessing an > int from a function where the int is at the global scope, without > explicitly declaring it as global but not when accessing a list in > similar circumstances. > There has just been a long thread about th

subprocess returncode always None

2006-07-09 Thread Corey Wallis
Dear All, I'm currently working on a project that needs to collect the output of the JHOVE application. More information about the application is available at this website: http://hul.harvard.edu/jhove/ The application is written in Java and is executed by a shell script. There are occasions whe

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Frank Millman wrote: > Paddy wrote: > > Hi, > > I am trying to work out why I get UnboundLocalError when accessing an > > int from a function where the int is at the global scope, without > > explicitly declaring it as global but not when accessing a list in > > similar circumstances. > > > > With

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Suppose a C extension locally built an array of PyObject* 's as > follows... > > my_array = malloc(n * sizeof(PyObject*)); > for (i = 0; i < n; i++) { >my_array[i] = PyList_New(0); > } > > Q1: Must I do a Py_DECREF(my_array[i]) on all elements > before ex

Re: Augument assignment versus regular assignment

2006-07-09 Thread Fredrik Lundh
Frank Millman wrote: > So it looks as if x += [] modifies the list in place, while x = x + [] > creates a new list. objects can override the += operator (by defining the __iadd__ method), and the list type maps __iadd__ to extend. other containers may treat += differently, but in-place behavi

xml aggregator

2006-07-09 Thread kepioo
Hi all, I am trying to write an xml aggregator, but so far, i've been failing miserably. what i want to do : i have entries, in a list format :[[key1,value],[key2,value],[ key3,value]], value] example : [["route","23"],["equip","jr2"],["time","3pm"]],"my first value"] [["route","23"],["equip",

WANTED: logging of all file operations on Windows

2006-07-09 Thread Claudio Grondi
I am aware, that it is maybe the wrong group to ask this question, but as I would like to know the history of past file operations from within a Python script I see a chance, that someone in this group was into it already and is so kind to share here his experience. I have put already much eff

Re: Inheritance error: class Foo has no attribute "bar"

2006-07-09 Thread Alan Franzoni
Il Sun, 09 Jul 2006 04:24:01 GMT, crystalattice ha scritto: > I can't see why it's saying this because Character.__init__(self) not only > has self.attrib_dict = {} but it also calls the setAttribute method > explicitly for each attribute name. If I do a print out of the dictionary > just fo

Re: I thought I'd 'got' globals but...

2006-07-09 Thread Bruno Desthuilliers
Luis M. González a écrit : > Bruno Desthuilliers wrote: > >>def doIt(name=None): >> global gname >> if name is None: >>name = gname >> else: >>gname = name >> > > > Sorry for this very basic question, but I don't understand why I should > add the global into the function body before u

Re: I thought I'd 'got' globals but...

2006-07-09 Thread Bruno Desthuilliers
Luis M. González a écrit : (snip) > OK, so I should include the global only if I plan to modify it. > Otherwise, I don't need to include it. Am I right? s/modify/rebind/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Bruno Desthuilliers
Frank Millman a écrit : > Paddy wrote: > >>Hi, >>I am trying to work out why I get UnboundLocalError when accessing an >>int from a function where the int is at the global scope, without >>explicitly declaring it as global but not when accessing a list in >>similar circumstances. >> > > > There

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Bruno Desthuilliers
Paddy a écrit : > Frank Millman wrote: > >>Paddy wrote: >> >>>Hi, >>>I am trying to work out why I get UnboundLocalError when accessing an >>>int from a function where the int is at the global scope, without >>>explicitly declaring it as global but not when accessing a list in >>>similar circumsta

can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
Pickling an instance of a class, gives "can't pickle instancemethod objects". What does this mean? How do I find the class method creating the problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: first book about python

2006-07-09 Thread Aahz
In article <[EMAIL PROTECTED]>, IOANNIS MANOLOUDIS <[EMAIL PROTECTED]> wrote: > >I want to learn python. >I plan to buy a book. I always find printed material more convenient than >reading on-line tutorials. >I don't know PERL or any other scripting language. I only know some BASH >programming. I

HTTPBasicAuthHandler doesn't work

2006-07-09 Thread nicolas . surribas
Hi ! I'm trying to add the HTTP basic authentification to my web spider but it doesn't work... The HTTPBasicAuthHandler don't send the headers for authentification :-( Here is the code : http://devloop.lyua.org/releases/lswww_urllib2.py def __init__(self,rooturl,firsturl=[],forbidden=[],proxy={},

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Piet van Oostrum
> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >AP> It is conceptually different. In the line 'a = b' you don't need to >AP> search for the scope of a. You know it is the current scope, if you Except when it has been declared global. >AP> want to know the scope of b on the other hand, you n

Re: Inheritance error: class Foo has no attribute "bar"

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 04:24:01 +, crystalattice wrote: > I've finally figured out the basics of OOP; I've created a basic character > creation class for my game and it works reasonably well. Now that I'm > trying to build a subclass that has methods to determine the rank of a > character b

scheduling accuracy for audio

2006-07-09 Thread andrea valle
Dear all, I have created a large Python-based GUI project and I'd like to use it as a GUI interface for real time audio sequencing (using the SuperCollider -SC- synthesis server). Python (the client) and SC (the server) can communicate via OSC protocol (there are available implementations). SC

Re: can't pickle instancemethod objects

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 05:45:27 -0700, Jim Lewis wrote: > Pickling an instance of a class, gives "can't pickle instancemethod > objects". What does this mean? It means you can't pickle instance methods. > How do I find the class method creating the problem? How about you post the complete stack t

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> How about you post the complete stack trace of the exception? Exception in Tkinter callback Traceback (most recent call last): File "C:\program files\python\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "C:\Public\world.py", line 1832, in BtnGo DoBtnGo()

Re: Mechanize-Browser question..

2006-07-09 Thread Tal Einat
bruce wrote: > r2 = br.follow_link(url_regex=re.compile(r"\*"),nr=1) <<< Seems to me your regex is buggy. You are using a "raw string" yet you still escape the asterisk ('*') with a backslash? This will only match a string which contains an asterisk, while I'm guessing you're trin

concatenate Numeric

2006-07-09 Thread Sheldon
Hi, I am trying to build a large array using concatenate function in python. So as I loop over the number of arrays, of which there are 12 (4 down and 3 across), I create 3 long arrays by concatenating them at the bottom and then concatenating them side by side: for ind in range(num_arrays):

Re: python/xpath question...

2006-07-09 Thread John J. Lee
(Damn gmane's authorizor, I think I lost four postings because the auth messages went to my work email address (and I thought the authorization was supposed to be one-time only per group anyway??). I deleted them as spam since I hadn't posted from there for days :-( Grrr. At least I could reconst

Re: concatenate Numeric

2006-07-09 Thread Sheldon
Sheldon skrev: > Hi, > > I am trying to build a large array using concatenate function in > python. > So as I loop over the number of arrays, of which there are 12 (4 down > and 3 across), I create 3 long arrays by concatenating them at the > bottom and then concatenating them side by side: > for

Re: python/xpath question...

2006-07-09 Thread John J. Lee
Stefan Behnel <[EMAIL PROTECTED]> writes: [...] > I'm not quite sure how this is supposed to be related to Python, but if you're > trying to find a sibling, what about using the "sibling" axis in XPath? There's no "sibling" axis in XPath. I'm sure you meant "following-sibling" and/or "preceding-

Re: first book about python

2006-07-09 Thread IOANNIS MANOLOUDIS
I thank everybody for your replies. I think I'll get Hertland's book since it's newer than O'reillys. I don't want to become a programmer. Neither Python is part of my studies. I've finished with my studies. I want to become a Unix/Linux admin and knowledge of either Python or Perl is an asset. Do

Remembering History in code.InteractiveConsole

2006-07-09 Thread Chris Spencer
I'd like to make code.InteractiveConsole function just like the normal Python console. However, when I try to use the arrow keys to recall command history, all I get is ^[[A^[[B. I've seen the example at http://docs.python.org/lib/readline-example.html but this doesn't seem to work at all, altho

Re: xml aggregator

2006-07-09 Thread Gerard Flanagan
kepioo wrote: > Hi all, > > I am trying to write an xml aggregator, but so far, i've been failing > miserably. > > what i want to do : > > i have entries, in a list format :[[key1,value],[key2,value],[ > key3,value]], value] > > example : > [["route","23"],["equip","jr2"],["time","3pm"]],"my first

Re: xpath question...

2006-07-09 Thread John J. Lee
"bruce" <[EMAIL PROTECTED]> writes: > i have the following section of test code where i'm trying to get the > attribute of a frame > > > i'm trying to print/get the src value. the xpath query that i have displays > the "src" attribute in the Xpather/Firefox plugin. however, i can't quite > fi

Re: python guru for urllib/mechanize

2006-07-09 Thread John J. Lee
"bruce" <[EMAIL PROTECTED]> writes: > i'm trying to get the pages from a site "axess.stanford.edu", and i'm > running into problems. i've got some test code that allows me to get the 1st > few pages. i'm having an issue when i run into a page that somehow > interprets a url from a src of a framese

Re: can't pickle instancemethod objects

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 07:06:25 -0700, Jim Lewis wrote: >> How about you post the complete stack trace of the exception? > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\program files\python\lib\lib-tk\Tkinter.py", line 1345, in > __call__ > return self.func(*a

Re: Module for creating a screenshot of a web page given a URL?

2006-07-09 Thread John J. Lee
[EMAIL PROTECTED] writes: > > Untestetd, but I'm pretty sure something like this will do. > > If you need more control, and on windows, try pywinauto > > I do need it to run on Windows. I'll check out pywinauto. Thanks. Note he didn't say you *need* pywinauto to run on Windows. John -- http:/

class members vs instance members

2006-07-09 Thread hdixon
Ive spent a few days going thru a couple of Python tutorials. No problem until I got to classes. I guess my java mindset is blocking my vision. I've borrowed another thread's code snippet and cannot explain the results: class MyClass: list = [] myvar = 10 def add(self, x): self

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> I'd suggest that "pop" could be your culprit. ...What is pop? A function or > an instance method? Neither. pop is an instance of a class, like: class X: ... pop = X () pop surely is the culprit but it has arrays of objects, etc., and I don't know what to look for. -- http://mail.python.or

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Antoon Pardon
On 2006-07-09, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: > >>AP> It is conceptually different. In the line 'a = b' you don't need to >>AP> search for the scope of a. You know it is the current scope, if you > > Except when it has been declared

Re: class members vs instance members

2006-07-09 Thread Bruno Desthuilliers
hdixon a écrit : > Ive spent a few days going thru a couple of Python tutorials. No > problem until I got to classes. I guess my java mindset is blocking my > vision. Then http://dirtsimple.org/2004/12/python-is-not-java.html > I've borrowed another thread's code snippet and cannot explain > the

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread faulkner
you want a directory watching daemon. it isn't hard at all to build from scratch. first, determine which directories should be watched. then, os.walk each directory, building a mapping from filename to mtime [modified time; os.path.getmtime]. next is your main event loop. this while loop consists o

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Antoon Pardon
On 2006-07-08, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 8 Jul 2006 18:52:56 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> >> I'm not fooled by that phrase. I just think the mutate vs rebind >> explanation is not complete. >> >> If we have tw

Re: can't pickle instancemethod objects

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 08:39:29 -0700, Jim Lewis wrote: >> I'd suggest that "pop" could be your culprit. ...What is pop? A function or >> an instance method? > > Neither. pop is an instance of a class, like: > class X: >... > pop = X () > > pop surely is the culprit but it has arrays of object

Re: xml aggregator

2006-07-09 Thread Gerard Flanagan
Gerard Flanagan wrote: > kepioo wrote: > > Hi all, > > > > I am trying to write an xml aggregator, but so far, i've been failing > > miserably. > > > > what i want to do : > > > > i have entries, in a list format :[[key1,value],[key2,value],[ > > key3,value]], value] > > > > example : > > [["route

Re: first book about python

2006-07-09 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > IOANNIS MANOLOUDIS <[EMAIL PROTECTED]> wrote: > > > >I want to learn python. > >I plan to buy a book. I always find printed material more convenient than > >reading on-line tutorials. > >I don't know PERL or any other scripting l

Re: first book about python

2006-07-09 Thread Alex Martelli
IOANNIS MANOLOUDIS <[EMAIL PROTECTED]> wrote: > I thank everybody for your replies. > I think I'll get Hertland's book since it's newer than O'reillys. > I don't want to become a programmer. Neither Python is part of my studies. > I've finished with my studies. I want to become a Unix/Linux admin

Re: cookielib incorrectly escapes cookie

2006-07-09 Thread John J. Lee
"BJörn Lindqvist" <[EMAIL PROTECTED]> writes: > I have some very serious trouble getting cookes to work. After a lot > of work (urllib2 is severly underdocumented, arcane and overengineerd > btw) I'm finally able to accept cookes from a server. But I'm still And a good day to you too ;-) In pass

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread Tim Golden
Claudio Grondi wrote: > I am aware, that it is maybe the wrong group to ask this question, but > as I would like to know the history of past file operations from within > a Python script I see a chance, that someone in this group was into it > already and is so kind to share here his experience.

Re: HTTPBasicAuthHandler doesn't work

2006-07-09 Thread John J. Lee
[EMAIL PROTECTED] writes: > Hi ! > I'm trying to add the HTTP basic authentification to my web spider but > it doesn't work... > The HTTPBasicAuthHandler don't send the headers for authentification > :-( Hi Several bugs were fixed with Basic auth in Python 2.5. I'd be most grateful if you can v

language design question

2006-07-09 Thread Gregory Guthrie
I am comparing Python to a few other scripting languages, and used a simple anagrams program as a sample. I was surprised ast a few python features that did not work as I would expect/wish; which caused less compact/expressive program styles that I wanted - reverting to a FORTRAN like series of

Re: first book about python

2006-07-09 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > Yes, Perl IS harder to learn, BUT -- if you've already decided to learn > both languages, starting with the harder one need not be a bad idea (the > Romans' legions, back when they were the best soldiers in the world, "Learning Perl" is actually a very w

Re: scheduling accuracy for audio

2006-07-09 Thread Paul Rubin
andrea valle <[EMAIL PROTECTED]> writes: > In order to have sequencing I have to send at precise timing messages > from Python to SC. Obviously, being a musical application, I need > millisecond time accuracy, with less latency as possible or at least a > fixed (short) latency. More, I need to have

Re: language design question

2006-07-09 Thread Steven Bethard
Gregory Guthrie wrote: > For example, >- why is len() not a member function of strings? Instead one says len(w). Why would ``x.len()`` be any more convenient than ``len(x)``? Your preference here seems pretty arbitrary. > - Why doesn't sort() return a value? > > This would allow thing

Re: language design question

2006-07-09 Thread Bruno Desthuilliers
Gregory Guthrie a écrit : > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive program styles that I > wanted -

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread Paul McGuire
"faulkner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > you want a directory watching daemon. it isn't hard at all to build > from scratch. > first, determine which directories should be watched. > then, os.walk each directory, building a mapping from filename to mtime > [modified

array of array of float

2006-07-09 Thread Summercoolness
i used C too much and haven't used Python for a while... like in C, if we want an array of array of float, we use float a[200][500]; now in Python, seems like we have to do something like a = [ [ ] ] * 200 and then just use a[1].append(12.34) etc but it turns out that all 200 elements poin

Re: array of array of float

2006-07-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > i used C too much and haven't used Python for a while... > > like in C, if we want an array of array of float, we use > > float a[200][500]; > > now in Python, seems like we have to do something like > > a = [ [ ] ] * 200 > > and then just use > > a[1].append(12.34

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread Paul McGuire
"faulkner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > you want a directory watching daemon. it isn't hard at all to build > from scratch. > first, determine which directories should be watched. > then, os.walk each directory, building a mapping from filename to mtime > [modified

Size of hard drive and Mp3 tags functions

2006-07-09 Thread John Hicken
I'm creating a Python program to pick a random set of mp3s, to copy to my mp3 player, so I can regularly get a new set to listen to. Anyway, there are two sorts of functions that could be useful. 1) A function that gives the size of a hard drive (or other drive, in this case the mp3 player itself)

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Bruno Desthuilliers wrote: > Frank Millman a écrit : > > Paddy wrote: > > > >>Hi, > >>I am trying to work out why I get UnboundLocalError when accessing an > >>int from a function where the int is at the global scope, without > >>explicitly declaring it as global but not when accessing a list in >

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Paddy wrote: > > So, > An assignment statement may assign an object to a name, in which case > the name is 'tagged' as being local, > An assignment statement may mutate a mutable object already bound to a > name, in which case the assignment will not 'tag' the name as being > local. > > I guess

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Fredrik Lundh
Paddy wrote: > ... irrelevant as in 'although only mutable objects can have their > state modified; if n has a mutable value but the assignment statement > changed n to refer to another object, then the name would be tagged as > local'? > > Oh bosh, can anyone come at it from a different tack? l

Re: array of array of float

2006-07-09 Thread DH
[EMAIL PROTECTED] wrote: > i used C too much and haven't used Python for a while... > > like in C, if we want an array of array of float, we use > > float a[200][500]; > > now in Python, seems like we have to do something like > > a = [ [ ] ] * 200 > > and then just use > > a[1].append(12.34)

Re: class members vs instance members

2006-07-09 Thread hdixon
Bruno Desthuilliers wrote: > hdixon a écrit : > > Ive spent a few days going thru a couple of Python tutorials. No > > problem until I got to classes. I guess my java mindset is blocking my > > vision. > > Then http://dirtsimple.org/2004/12/python-is-not-java.html > > > I've borrowed another threa

Re: Nested scopes, and augmented assignment

2006-07-09 Thread Piet van Oostrum
> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >AP> When someone gets confused over the difference between rebinding or >AP> mutating a variable on an intermediate scope, the explanation he >AP> mostly seems to get boils down to: one is rebinding, the other is >AP> mutation, this is a fundame

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Bruno Desthuilliers
Paddy a écrit : > Bruno Desthuilliers wrote: > >>Frank Millman a écrit : >> >>>Paddy wrote: >>> >>> Hi, I am trying to work out why I get UnboundLocalError when accessing an int from a function where the int is at the global scope, without explicitly declaring it as global but not

Re: language design question

2006-07-09 Thread Paddy
Gregory Guthrie wrote: > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive program styles that I > wanted - rever

tk filesave dialog triggers unexpected destroy event

2006-07-09 Thread John Hunter
The following behavior surprised me. I have a Tk window and launch a file save dialog from it. When the filesave dialog is finished, it calls callbacks bound to the destroy event on the main window. Is this expected, and can I avoid this? To expose the problem, run this script and click the mo

Weekly Python Patch/Bug Summary

2006-07-09 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 393 open (+15) / 3315 closed (+17) / 3708 total (+32) Bugs: 908 open (+22) / 5975 closed (+49) / 6883 total (+71) RFE : 223 open ( -1) / 229 closed ( +2) / 452 total ( +1) New / Reopened Patches __ test_grp.

RE: [wwwsearch-general] ClientForm request re ParseErrors

2006-07-09 Thread bruce
hi john... not sure exactly who i should talk to tabout this..but here goes... i have the following piece of code... i'm trying to do a select form, and my test throws an error... i have the actual form "main" in the html, so it should find it... as far as i can tell, i've followed the docs.. bu

Re: concatenate Numeric

2006-07-09 Thread Robert Kern
Sheldon wrote: > Hi, > > I am trying to build a large array using concatenate function in > python. > So as I loop over the number of arrays, of which there are 12 (4 down > and 3 across), I create 3 long arrays by concatenating them at the > bottom and then concatenating them side by side: [snip

Re: array of array of float

2006-07-09 Thread Schüle Daniel
[EMAIL PROTECTED] schrieb: > i used C too much and haven't used Python for a while... > > like in C, if we want an array of array of float, we use > > float a[200][500]; > > now in Python, seems like we have to do something like > > a = [ [ ] ] * 200 > > and then just use > > a[1].append(12.3

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Bruno Desthuilliers wrote: > Paddy a écrit : > > Bruno Desthuilliers wrote: > > > >>Frank Millman a écrit : > >> > >>>Paddy wrote: > >>> > >>> > Hi, > I am trying to work out why I get UnboundLocalError when accessing an > int from a function where the int is at the global scope, witho

Re: array of array of float

2006-07-09 Thread Schüle Daniel
Schüle Daniel schrieb: > [EMAIL PROTECTED] schrieb: >> i used C too much and haven't used Python for a while... >> >> like in C, if we want an array of array of float, we use >> >> float a[200][500]; >> >> now in Python, seems like we have to do something like >> >> a = [ [ ] ] * 200 >> >> and then

Re: array of array of float

2006-07-09 Thread tac-tics
Use nested list comprehensions: matrix = [[0.0 for x in xrange(n)] for y in xrange(m)] This is similar to "float matrix[m][n]" in C. All cells are independent of each other in doing this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Dennis Lee Bieber wrote: > On 9 Jul 2006 11:30:06 -0700, "Paddy" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > So, > > An assignment statement may assign an object to a name, in which case > > the name is 'tagged' as being local, > > Reverse... Python does not "assi

Re: scheduling accuracy for audio

2006-07-09 Thread andrea valle
Thanks Paul, that's what I suspected. -a- On 9 Jul 2006, at 19:22, Paul Rubin wrote: > andrea valle <[EMAIL PROTECTED]> writes: >> In order to have sequencing I have to send at precise timing messages >> from Python to SC. Obviously, being a musical application, I need >> millisecond time accu

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Bruno Desthuilliers
Paddy a écrit : > Dennis Lee Bieber wrote: > >>On 9 Jul 2006 11:30:06 -0700, "Paddy" <[EMAIL PROTECTED]> declaimed >>the following in comp.lang.python: >> >> >>>So, >>>An assignment statement may assign an object to a name, in which case >>>the name is 'tagged' as being local, >> >> Reverse..

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Fredrik Lundh wrote: > Paddy wrote: > > > ... irrelevant as in 'although only mutable objects can have their > > state modified; if n has a mutable value but the assignment statement > > changed n to refer to another object, then the name would be tagged as > > local'? > > > > Oh bosh, can anyone

Re: Scope, type and UnboundLocalError

2006-07-09 Thread Paddy
Bruno Desthuilliers wrote: Ta. -- http://mail.python.org/mailman/listinfo/python-list

Re: can't pickle instancemethod objects

2006-07-09 Thread Jim Lewis
> Here's a thought: comment out every attribute in your class, and then try > pickling it. If it succeeds, uncomment just *one* attribute, and try > pickling again. Repeat until pickling fails. Was trying to avoid that but you motivated me to do so and now I found the probem. In a utility routine

Re: looping question 4 NEWB

2006-07-09 Thread manstey
Thanks Marc, that was very helpful. Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, manstey wrote: > > > I often have code like this: > > > > data='asdfbasdf' > > find = (('a','f')('s','g'),('x','y')) > > for i in find: > >if i[0] in data: > >data = data.replace(i[0],i[1]) >

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread Claudio Grondi
faulkner wrote: > you want a directory watching daemon. it isn't hard at all to build > from scratch. > first, determine which directories should be watched. > then, os.walk each directory, building a mapping from filename to mtime > [modified time; os.path.getmtime]. > next is your main event loop

Re: Size of hard drive and Mp3 tags functions

2006-07-09 Thread John Hicken
Dennis Lee Bieber wrote: > On 9 Jul 2006 11:14:25 -0700, "John Hicken" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > Anyway, there are two sorts of functions that could be useful. > > 1) A function that gives the size of a hard drive (or other drive, in > > this case t

Re: please remove posting we are receiving unsolicited emails

2006-07-09 Thread Terry Reedy
"homeprice maps" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >dear python , Python is a language, not a person that can act in in this universe. >as a result of the following posting we are receiving emails from >people >regarding services and websites we have no relation to.

Re: WANTED: logging of all file operations on Windows

2006-07-09 Thread Claudio Grondi
Tim Golden wrote: > Claudio Grondi wrote: > >> I am aware, that it is maybe the wrong group to ask this question, but >> as I would like to know the history of past file operations from >> within a Python script I see a chance, that someone in this group was >> into it already and is so kind to

Re: language design question

2006-07-09 Thread Terry Reedy
"Gregory Guthrie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - why is len() not a member function of strings? Instead one says > len(w). Consider >>> map(len, ('abc', (1,2,3), [1,2], {1:2})) [3, 3, 2, 1] Now try to rewrite this using methods (member functions). > - Why d

Re: language design question

2006-07-09 Thread OKB (not okblacke)
Terry Reedy wrote: > Consider map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using methods (member functions). [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, inste

Re: language design question

2006-07-09 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes: > Consider > >>> map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using methods (member functions). [x.len() for x in ('abc', (1,2,3), [1,2], {1:2})] > > - Why doesn't sort() return a value? > > Because it is an in-pl

Re: urllib2 on Windows Vista

2006-07-09 Thread Sriram Krishnan
Rune Strand wrote: > My wil guess is that it is a firewall problem. Perhaps you'll have to > specify that python.exe is trusted. Tried that - it didn't work. I also tried turning off the User Account Control and ran as full administrator - that didn't work too. -- http://mail.python.org/mailman

Re: language design question

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 12:19:13 -0500, Gregory Guthrie wrote: > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive

Validating Python - need doctype HTML strict

2006-07-09 Thread PapaRandy
Hello, I am trying to validate the following .py webpage as HTML (through W3C). I put: - print "Content-type: text/html; charset=utf-8" import time print print """ Current Time Current Time""" print "Right now

Re: language design question

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 22:45:53 +, OKB (not okblacke) wrote: > Terry Reedy wrote: > >> Consider > map(len, ('abc', (1,2,3), [1,2], {1:2})) >> [3, 3, 2, 1] >> >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] Did you actually

help a newbie with a IDE/book combination

2006-07-09 Thread mamadu
Hi, I already have a couple of newbie books on Python itself, but would rather get started with a nice to use IDE and I am therefore looking for a good IDE to learn Python. On my computer I have installed eric (http://ericide.python-hosting.com/) but it lacks any kind of useful documentation on i

Re: pyXLWriter - grid lines and if formula

2006-07-09 Thread Luis P. Mendes
Gregory Piñero escreveu: > On 7/7/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I know that pyExelerator is the supported project now, but I can't use >> it because I'd need it to generate files from a web platform. Since I >> can not save a file to a file-like object, I have to use py

unistall python mechanize

2006-07-09 Thread bruce
hi.. i'm trying to figure out how to uninstall "mechanize". i don't see an "unistall" from the "python --help-commands" function... i'm looking to rebuild/reinstall mechanize from the svn repos to try to see if an apparent parsing issue that i mentioned is fixed... thanks -bruce -- http://m

Re: language design question

2006-07-09 Thread Erik Max Francis
Steven D'Aprano wrote: > On Sun, 09 Jul 2006 22:45:53 +, OKB (not okblacke) wrote: > >> Terry Reedy wrote: >> >>> Consider >> map(len, ('abc', (1,2,3), [1,2], {1:2})) >>> [3, 3, 2, 1] >>> >>> Now try to rewrite this using methods (member functions). >> [a.len() for a in ('abc', (1,2,3), [

Re: language design question

2006-07-09 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] > > Did you actually try that? No of course not. It's in a hypothetical python where .len() is a class operation instead of a global fu

Re: language design question

2006-07-09 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Length is an obvious property of any one-dimensional non-scalar, not just > strings. As such, it makes sense to have a length function that takes an > argument. As a design decision, it could go either way, but early > Python wasn't fully object-oriente

Re: pyXLWriter - grid lines and if formula

2006-07-09 Thread Waldemar Osuch
Luis P. Mendes wrote: > Gregory Piñero escreveu: > > On 7/7/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote: > >> Hi, > >> > >> I know that pyExelerator is the supported project now, but I can't use > >> it because I'd need it to generate files from a web platform. Since I > >> can not save a file to

RE: [wwwsearch-general] ClientForm request re ParseErrors

2006-07-09 Thread bruce
update. out of curiosity, i fetched the latest mechanize from svn.. i get the same error with the parse... i've also tried to do: br.select_form(nr = 1) br.select_form(name="foo") br.select_form(name=foo) br.select_form(name="foo") etc same err occurs... -bruce hi john... not s

Re: first book about python

2006-07-09 Thread IOANNIS MANOLOUDIS
I guess it's better to wait for the for dummies book. I should focus instead in taking the LPIC-2 exams in September. Ioannis -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >