ANN: Python cgkit v2.0.0alpha9

2009-08-26 Thread mbaas
A new version (2.0.0alpha9) of the Python Computer Graphics Kit is available at http://cgkit.sourceforge.net/ What is it? --- The Python Computer Graphics Kit is a collection of utilities and Python modules that simplify working with 3D data of any kind. The provided functionality can be

Re: your favorite debugging tool?

2009-08-26 Thread Paul Rubin
Dennis Lee Bieber wlfr...@ix.netcom.com writes: My normal debug technique is wolf fencing* (eg; print statements) That method was formerly completely automated on the web: http://www.st.cs.uni-saarland.de/askigor/faq.php It was amazing. Further info is here:

Re: Object Reference question

2009-08-26 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 21:32:09 Aahz wrote: In article mailman.164.1250837108.2854.python-l...@python.org, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 21 August 2009 08:07:18 josef wrote: My main focus of this post is: How do I find and use object reference memory

Re: Code formatting question: conditional expression

2009-08-26 Thread Ben Finney
Nicola Larosa (tekNico) nicola.lar...@gmail.com writes: Nicola Larosa wrote: Here's my take:     excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True         ) if total P.BASE else None Oops, it got shortened out: line longer than 72 chars, acceptable in code, but

Re: Need help with Python scoping rules

2009-08-26 Thread Ulrich Eckhardt
Jean-Michel Pichavant wrote: class Color: def __init__(self, r, g,b): pass BLACK = Color(0,0,0) It make sens from a design point of view to put BLACK in the Color namespace. But I don't think it's possible with python. class Color: ... setattrib(Color, BLACK,

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-26 Thread Diez B. Roggisch
Evan Driscoll schrieb: On Aug 25, 3:47 pm, Evan Driscoll eva...@gmail.com wrote: So here is my simplified version that only works for globals: So I think this works if (1) you only use changed_value in the same module as it's defined in (otherwise it picks up the globals from the module it's

Re: PyObject_CallFunction and writable memory

2009-08-26 Thread Diez B. Roggisch
Christopher Nebergall schrieb: I'm working a patch to a hex editor (frhed) written in c++ so it can load python scripts. Internally the c++ code has a unsigned char * of possibly serveral hundred megs which I want to send into the python code to modify.What is the best way to send the

Re: PyObject_CallFunction and writable memory

2009-08-26 Thread Benjamin Peterson
Christopher Nebergall christopher.nebergall at gmail.com writes: I'm currently using PyObject_CallFunction(pFunc, (s#),p-lpbMemory, p-dwSize); to send an immutable string but I haven't seen what I need to set in the format string which makes the data writable to python.The solution can

Re: Python, qt, and lgpl

2009-08-26 Thread Diez B. Roggisch
sturlamolden schrieb: On 25 Aug, 21:45, Terry Reedy tjre...@udel.edu wrote: Will be good news if realized. Good news for everyone except Riverbank. And only if LGPL is something you can live with. Some projects require more liberal licenses. Or is there a commercial license available,

Re: conditional for-statement

2009-08-26 Thread seb
On Aug 25, 11:57 pm, Piet van Oostrum p...@cs.uu.nl wrote: You can also say: [x+y for x in range(3) for y in range(4) if x y] If you want to write this as a loop you have to put the for's on separate lines separated by colons, so why not the if also? Or would you also like to have the for's

Re: break unichr instead of fix ord?

2009-08-26 Thread Vlastimil Brom
2009/8/25 ru...@yahoo.com: In Python 2.5 on Windows I could do [*1]:  # Create a unicode character outside of the BMP.   a = u'\U00010040'  # On Windows it is represented as a surogate pair.   len(a)  2   a[0],a[1]  (u'\ud800', u'\udc40')  # Create the same character with the unichr()

Re: Python for professsional Windows GUI apps?

2009-08-26 Thread Simon Brunning
2009/8/26 geekworking geekwork...@gmail.com: If you are planning a database driven app, you should first settle on a DB server. Any real enterprise DB system will put all of the business logic in the database server. The choice of a front end should be secondary. The trend for some years now

Getting the current PyCFunction while in a python function

2009-08-26 Thread Prémon Nom
Hi I would like to get the PyCFunction object which corresponds to the current function which is executed. I call PyFrameObject* frame = PyEval_GetFrame() I try to parse frame-f_valuestack, but I don't know how to get the index of the function in the stack or event the size of the stack to be

Re: Python on the Web

2009-08-26 Thread Bruno Desthuilliers
Phil a écrit : I've seen lots of web sites explaining everything, but for whatever reason I seem to not be picking something up. I am a graphical person, which is probably the reason I haven't found my answer. May somebody please confirm if my diagram accurately represents the stack, generally

Move dictionary from instance to class level

2009-08-26 Thread Frank Millman
Hi all I have a class that uses a dictionary to map message numbers to methods. Here is a simple example - class MyClass(object): def __init__(self): self.method_dict = {} self.method_dict[0] = self.method_0 self.method_dict[1] = self.method_1

Re: Python for professsional Windows GUI apps?

2009-08-26 Thread erikj
Hi, You could have a look at Camelot, to see if it fits your needs : http://www.conceptive.be/projects/camelot/ it was developed with cross platform business apps in mind. when developing Camelot, we tried to build it using wxWidgets first (because of the licensing at that time), but it turned

Re: print() and unicode strings (python 3.1)

2009-08-26 Thread Piet van Oostrum
7stud bbxx789_0...@yahoo.com (7) wrote: 7 Thanks for the response. My OS is mac osx 10.4.11. I'm not really 7 sure how to check my locale settings. Here is some stuff I tried: 7 $ echo $LANG 7 $ echo $LC_ALL 7 $ echo $LC_CTYPE 7 $ locale 7 LANG= 7 LC_COLLATE=C 7 LC_CTYPE=C 7 LC_MESSAGES=C

Re: Move dictionary from instance to class level

2009-08-26 Thread Chris Rebert
On Wed, Aug 26, 2009 at 1:22 AM, Frank Millmanfr...@chagford.com wrote: Hi all I have a class that uses a dictionary to map message numbers to methods. Here is a simple example -    class MyClass(object):        def __init__(self):            self.method_dict = {}            

Q: multiprocessing.Queue size limitations or bug...

2009-08-26 Thread Michael Riedel
Sorry for being not more specific but I'm not absolutely certain whether I encountered a bug or did anything wrong: The (stupid) code below results in a stall forever or not at 'p0.join()' depending on the value of TROUBLE_MAKER. Any help, thoughts, comments? Thank you for your time. Michael

Re: Move dictionary from instance to class level

2009-08-26 Thread Frank Millman
On Aug 26, 10:54 am, Chris Rebert c...@rebertia.com wrote: On Wed, Aug 26, 2009 at 1:22 AM, Frank Millmanfr...@chagford.com wrote: A class MyClass(object): def on_message_received(self, msg): self.method_dict[msg](self) def method_0(self): print 'in method_0'

Re: Move dictionary from instance to class level

2009-08-26 Thread Frank Millman
On Aug 26, 10:54 am, Chris Rebert c...@rebertia.com wrote: On Wed, Aug 26, 2009 at 1:22 AM, Frank Millmanfr...@chagford.com wrote: A class MyClass(object): def on_message_received(self, msg): self.method_dict[msg](self) def method_0(self): print 'in method_0'

Re: Move dictionary from instance to class level

2009-08-26 Thread Frank Millman
On Aug 26, 10:54 am, Chris Rebert c...@rebertia.com wrote: On Wed, Aug 26, 2009 at 1:22 AM, Frank Millmanfr...@chagford.com wrote: A class MyClass(object): def on_message_received(self, msg): self.method_dict[msg](self) def method_0(self): print 'in method_0'

Re: Help with arrays

2009-08-26 Thread Stephen Fairchild
Dave Angel wrote: With this change the best solution changes from a random shuffle to a binary search. Which is not what the OP asked for. Anyway, I think whatever solution is chosen it's probably best written as a generator. The new pushback syntax may prove useful. -- Stephen Fairchild --

all possible matchings of elements of two lists

2009-08-26 Thread Sandy
Hi all, I basically want all possible matchings of elements from two lists, Ex: [1,2] [a,b,c] Required: [ [(1,a),(2,b)] [(1,b),(2,c)] [(1,c),(2,b)] [(1,b),(2,a)] [(1,c),(2,a)] [(1,a),(2,c)] ] My thought is to get all possible permutations of two lists given and

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In mailman.407.1251237485.2854.python-l...@python.org John Posner jjpos...@optimum.net writes: Stephen Hansen said: This sounds like a fundamental confusion -- a namespace is not equivalent to a scope, really, I think. ... snip Hmm. I can't find Stephen Hansen's original post anywhere.

Re: Python, qt, and lgpl

2009-08-26 Thread Carl Banks
On Aug 25, 5:04 pm, sturlamolden sturlamol...@yahoo.no wrote: On 25 Aug, 21:45, Terry Reedy tjre...@udel.edu wrote: Will be good news if realized. Good news for everyone except Riverbank. Oh well, Riverbank could have played ball but they didn't, so I guess I don't care if it's bad news for

Re: Python Processor

2009-08-26 Thread manish
Hi, I am also wondering about how to implement a soft core reconfigurable processor in a FPGA which would directly execute the compiled python bytecode. I am trying to understand the bytecode format but apart from http://docs.python.org/library/dis.html there is hardly any documentation on the

ubuntu dist-packages

2009-08-26 Thread Robin Becker
I was surprised a couple of days ago when trying to assist a colleage with his python setup on a ubuntu 9.04 system. We built our c-extensions and manually copied them into place, but site-packages wasn't there. It seems that ubuntu now wants stuff to go into lib/python2.6/dist-packages.

Re: all possible matchings of elements of two lists

2009-08-26 Thread dksr
Ok this is how I do it: l1 = [1,2] l2= ['a','b','c'] res = [] l2 = permute(l2) for i in l2: lis = [l1,l2] res.append(zip(*lis)) # or use map depending on what u want res.append(map(None,*lis)) print res On Aug 26, 11:05 am, Sandy dksre...@gmail.com wrote: Hi all, I basically

TypeError: _getfullpathname() argument 1 must be (buffer overflow), not str in windows xp, while making tarfile

2009-08-26 Thread Ryniek90
[snip] Here's my script code: *http://paste.ubuntu.com/259310/ *Shouldn't that bug be patched already :-? Are you giving it the contents of the file when it's actually expecting the filename? Of course the content of the file: [snip] See? *backup_obj.add(read_obj.read())* In previous

Re: ubuntu dist-packages

2009-08-26 Thread Diez B. Roggisch
Robin Becker wrote: I was surprised a couple of days ago when trying to assist a colleage with his python setup on a ubuntu 9.04 system. We built our c-extensions and manually copied them into place, but site-packages wasn't there. It seems that ubuntu now wants stuff to go into

Re: all possible matchings of elements of two lists

2009-08-26 Thread Mark Dickinson
On Aug 26, 11:05 am, Sandy dksre...@gmail.com wrote: Hi all, I basically want all possible matchings of elements from two lists, Ex: [1,2] [a,b,c] Required:    [ [(1,a),(2,b)]      [(1,b),(2,c)]      [(1,c),(2,b)]      [(1,b),(2,a)]      [(1,c),(2,a)]      [(1,a),(2,c)]    ] If you're

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 7figv3f2m3p0...@mid.uni-berlin.de Diez B. Roggisch de...@nospam.web.de writes: Classes are not scopes. This looks to me like a major wart, on two counts. First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. Your comment

Re: multiprocessing managers and socket connection.

2009-08-26 Thread Chris
On Aug 25, 9:11 pm, Terry terry.yin...@gmail.com wrote: On Aug 25, 10:14 pm, Chris chris...@gmail.com wrote: I've been using multiprocessing managers and I really like the functionality. I have a question about reconnecting to a manager. I have a situation where I start on one machine

Re: Need help with Python scoping rules

2009-08-26 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: Jean-Michel Pichavant wrote: class Color: def __init__(self, r, g,b): pass BLACK = Color(0,0,0) It make sens from a design point of view to put BLACK in the Color namespace. But I don't think it's possible with python. class Color: ...

Usefull python tutorial

2009-08-26 Thread gentlestone
Can somebody give me an advise where I can found a really good online tutorial? All I found are useless. For example no tutorial I found explains this piece of code: someList = [element for element in otherList if element is not None] or this example: a = a or [] There are only stupid

Re: Need help with Python scoping rules

2009-08-26 Thread Dave Angel
Ulrich Eckhardt wrote: Jean-Michel Pichavant wrote: class Color: def __init__(self, r, g,b): pass BLACK = Color(0,0,0) It make sens from a design point of view to put BLACK in the Color namespace. But I don't think it's possible with python. class Color: ...

pygtk - What is the best way to change the mouse pointer

2009-08-26 Thread Ido Levy
Hello All, I am writing a dialog which one of its widget is a gtk.ComboBoxEntry ( let's assume widget in the example below is its instance ) When the user select one of the values from the gtk.ComboBoxEntry I need to run some calculations that takes a few seconds. In order to reflect

Re: Move dictionary from instance to class level

2009-08-26 Thread MRAB
Frank Millman wrote: On Aug 26, 10:54 am, Chris Rebert c...@rebertia.com wrote: On Wed, Aug 26, 2009 at 1:22 AM, Frank Millmanfr...@chagford.com wrote: A class MyClass(object): def on_message_received(self, msg): self.method_dict[msg](self) def method_0(self): print

Re: ubuntu dist-packages

2009-08-26 Thread Ben Finney
Robin Becker ro...@reportlab.com writes: What is the relation between dist-packages/site-packages if any? Is this just a name change or is there some other problem being addressed? The problem being addressed is to maintain the distinction between OS-vendor-managed files versus

Object's nesting scope

2009-08-26 Thread zaur
Hi folk! What do you think about idea of object's nesting scope in python? Let's imaging this feature, for example, in this syntax: obj=expression: body or expression: body That's means that result object of expression evaluation is used as nested scope for body evaluation. So is

Re: Need help with Python scoping rules

2009-08-26 Thread Martin P. Hellwig
kj wrote: cut First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. Who says? Anyway, you could be right (I am not capable to judge it) and Python should change on this issue but from what I gathered, Pythons OO is inspired by

Re: Code formatting question: conditional expression

2009-08-26 Thread Jorgen Grahn
On Wed, 26 Aug 2009 16:47:33 +1000, Ben Finney ben+pyt...@benfinney.id.au wrote: Nicola Larosa (tekNico) nicola.lar...@gmail.com writes: Nicola Larosa wrote: Here's my take:     excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True         ) if total P.BASE else None

Re: Object's nesting scope

2009-08-26 Thread Diez B. Roggisch
zaur wrote: Hi folk! What do you think about idea of object's nesting scope in python? Let's imaging this feature, for example, in this syntax: obj=expression: body or expression: body That's means that result object of expression evaluation is used as nested scope

Re: Need help with Python scoping rules

2009-08-26 Thread 7stud
On Aug 25, 7:26 pm, Dave Angel da...@ieee.org wrote: Stephen Fairchild wrote: You are trying to run code in a class that does not exist yet. def Demo():     def fact(n):         if n 2:             return 1         else:             return n * fact(n - 1)     return type(Demo,

JOBS IN ALASKA IT JOBS IN ALASKA JOBS IN ALASKA IT JOBS IN ALASKA jobs in alaska anchorage jobs in alaska oil jobs in alaska usa jobs in alaska mines ON http://jobs-in-alaska.blogspot

2009-08-26 Thread Jawad Alam
JOBS IN ALASKA IT JOBS IN ALASKA JOBS IN ALASKA IT JOBS IN ALASKA jobs in alaska anchorage jobs in alaska oil jobs in alaska usa jobs in alaska mines ON http://jobs-in-alaska.blogspot.com/ JOBS IN ALASKA IT JOBS IN ALASKA JOBS IN ALASKA IT JOBS IN ALASKA jobs in alaska anchorage jobs in alaska oil

Re: print() and unicode strings (python 3.1)

2009-08-26 Thread 7stud
On Aug 25, 6:34 am, Nobody nob...@nowhere.com wrote: The underlying OS primitive can only handle bytes. If you read or write a (unicode) string, Python needs to know which encoding is used. For Python file objects created by the user (via open() etc), you can specify the encoding; for those

Re: Help with arrays

2009-08-26 Thread Mart.
On Aug 26, 3:02 am, Dave Angel da...@ieee.org wrote: Stephen Fairchild wrote: Philip Semanchuk wrote: On Aug 25, 2009, at 6:14 PM, Gleb Belov wrote: Hello! I'm working on an exercise wherein I have to write a Guess The Number game, but it's the computer who's guessing MY number. I can

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In jeqdncamuyvtrwjxnz2dnuvz8ludn...@bt.com Martin P. Hellwig martin.hell...@dcuktec.org writes: kj wrote: cut First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. Who says? Python itself: it already offers a limited form of

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 16b72319-8023-471c-ba40-8025aa6d4...@a26g2000yqn.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. =A0Your comment suggests that Python does not fully support

Zlib: correct checksum but error decompressing

2009-08-26 Thread Andre
I have been trying to solve this issue for a while now. I receive data from a TCP connection which is compressed. I know the correct checksum for the data and both the client and server generate the same checksum. However, in Python when it comes to decompressing the data I get the exception:

Re: os.popen output different from native shell output

2009-08-26 Thread Nobody
On Tue, 25 Aug 2009 11:42:31 -0700, nickname wrote: The reason why I want to do this is because I am going to do a little project. I will write a python script called ls which will log the time and username and then will show the actual ls output. I want this to be transparent and so want to

Re: Need help with Python scoping rules

2009-08-26 Thread Dave Angel
7stud wrote: On Aug 25, 7:26 pm, Dave Angel da...@ieee.org wrote: Stephen Fairchild wrote: You are trying to run code in a class that does not exist yet. def Demo(): def fact(n): if n 2: return 1 else: return n * fact(n - 1)

Re: Need help with Python scoping rules

2009-08-26 Thread Mel
kj wrote: Is there any good reason (from the point of view of Python's overall design) for not fixing this? Python is not a compiled language, in the sense that a compiler can go back and forth over the program, filling in the details that make the program runnable. Python is an interpreted

Re: Move dictionary from instance to class level

2009-08-26 Thread Frank Millman
MRAB pyt...@mrabarnett.plus.com wrote in message news:mailman.444.1251290454.2854.python-l...@python.org... An alternative is: class MyClass(object): ... def on_message_received(self, msg): ... try: ... getattr(self, method_%d % msg)() ... except

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
On Aug 26, 7:09 am, kj no.em...@please.post wrote: In 16b72319-8023-471c-ba40-8025aa6d4...@a26g2000yqn.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. =A0Your

Re: Need help with Python scoping rules

2009-08-26 Thread Dave Angel
kj wrote: In 7figv3f2m3p0...@mid.uni-berlin.de Diez B. Roggisch de...@nospam.web.de writes: Classes are not scopes. This looks to me like a major wart, on two counts. First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In mailman.447.1251297107.2854.python-l...@python.org Dave Angel da...@ieee.org writes: Thanks for diluting my point. The OP is chasing the wrong problem. Who cares whether a class initializer can call a method, if the method doesn't meet its original requirements, to be callable outside the

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-26 Thread Carl Banks
On Aug 25, 1:07 pm, Evan Driscoll eva...@gmail.com wrote: On Aug 25, 2:33 pm, Evan Driscoll eva...@gmail.com wrote: I want to make a context manager that will temporarily change the value of a variable within the scope of a 'with' that uses it. This is inspired by a C++ RAII object I've

Raw data extraction question

2009-08-26 Thread Maggie
i have event timing stretch of code i need to alter. here is code below: -- # we start each run with one full silent trial # creating a stub with the duration of a full block # less the discarded acquisitions stub = block_dur - (distax * tr) feed = sys.stdin.readlines() sess = -1 for

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: On Aug 26, 7:09=A0am, kj no.em...@please.post wrote: In 16b72319-8023-471c-ba40-8025aa6d4...@a26g2000yqn.googlegroups.com Ca= rl Banks pavlovevide...@gmail.com writes: First, one

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Steven D'Aprano
On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two,

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In mailman.415.1251250004.2854.python-l...@python.org Dave Angel da...@ieee.org writes: Stephen Fairchild wrote: You are trying to run code in a class that does not exist yet. def Demo(): def fact(n): if n 2: return 1 else: return n * fact(n

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
On Aug 26, 8:13 am, Dave Angel da...@ieee.org wrote: You can probably work around this by replacing the staticmethod decorator with an equivalent function call:. class Demo9(object):     def fact(n):         if n 2:             return 1         else:             return n * Demo.fact(n -

Re: Zlib: correct checksum but error decompressing

2009-08-26 Thread InvisibleRoads Patrol
On Wed, 26 Aug 2009 07:19:42 -0700 (PDT), Andre andre.co...@gmail.com wrote: I have been trying to solve this issue for a while now. I receive data from a TCP connection which is compressed. I know the correct checksum for the data and both the client and server generate the same checksum.

Re: Need help with Python scoping rules

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 10:57:32 +, kj wrote: In 7figv3f2m3p0...@mid.uni-berlin.de Diez B. Roggisch de...@nospam.web.de writes: Classes are not scopes. This looks to me like a major wart, on two counts. First, one of the goals of OO is encapsulation, not only at the level of instances,

Re: Help with arrays

2009-08-26 Thread Dave Angel
Mart. wrote: On Aug 26, 3:02 am, Dave Angel da...@ieee.org wrote: Stephen Fairchild wrote: Philip Semanchuk wrote: On Aug 25, 2009, at 6:14 PM, Gleb Belov wrote: Hello! I'm working on an exercise wherein I have to write a Guess The Number game, but it's the computer

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: Yeah, it's a little surprising that you can't access class scope from a function, but that has nothing to do with encapsulation. It does: it thwarts encapsulation. The helper

Re: Need help with Python scoping rules

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 13:57:23 +, kj wrote: In jeqdncamuyvtrwjxnz2dnuvz8ludn...@bt.com Martin P. Hellwig martin.hell...@dcuktec.org writes: kj wrote: cut First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. Who says?

Re: Need help with Python scoping rules

2009-08-26 Thread Nigel Rantor
kj wrote: Needless to say, I'm pretty beat by this point. Any help would be appreciated. Thanks, Based on your statement above, and the fact that multiple people have now explained *exactly* why your attempt at recursion hasn't worked, it might be a good idea to step back, accept the

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 02a54597$0$20629$c3e8...@news.astraweb.com Steven D'Aprano st...@remove-this-cybersource.com.au writes: On Wed, 26 Aug 2009 10:57:32 +, kj wrote: Recursion! One of the central concepts in the theory of functions! This is shown most clearly by the following elaboration of my original

Re: ubuntu dist-packages

2009-08-26 Thread Jorgen Grahn
On Wed, 26 Aug 2009 12:46:13 +0200, Diez B. Roggisch de...@nospam.web.de wrote: Robin Becker wrote: I was surprised a couple of days ago when trying to assist a colleage with his python setup on a ubuntu 9.04 system. We built our c-extensions and manually copied them into place, but

Re: Move dictionary from instance to class level

2009-08-26 Thread Dave Angel
Frank Millman wrote: MRAB pyt...@mrabarnett.plus.com wrote in message news:mailman.444.1251290454.2854.python-l...@python.org... An alternative is: class MyClass(object): ... def on_message_received(self, msg): ... try: ... getattr(self, method_%d %

Re: Need help with Python scoping rules

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 14:09:57 +, kj wrote: 1. One of the key aspects of Python's design is that attributes must be accessed explicitly with dot notation. Accessing class scopes from nested functions would (seemingly) allow access to class attributes without the dotted notation. Therefore it

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
On Aug 26, 8:36 am, kj no.em...@please.post wrote: In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: Yeah, it's a little surprising that you can't access class scope from a function, but that has nothing to do with encapsulation.

Re: ubuntu dist-packages

2009-08-26 Thread Robin Becker
Jorgen Grahn wrote: On Wed, 26 Aug 2009 12:46:13 +0200, Diez B. Roggisch Well, if you are thinking about Debian Linux, it's not as much ripping out as splitting into a separate package with a non-obvious name. Annoying at times, but hardly an atrocity. so where is the official place

Re: Python Processor

2009-08-26 Thread Terry Reedy
manish wrote: Hi, I am also wondering about how to implement a soft core reconfigurable processor in a FPGA which would directly execute the compiled python bytecode. I am trying to understand the bytecode format but apart from http://docs.python.org/library/dis.html there is hardly any

Re: Need help with Python scoping rules

2009-08-26 Thread Steven D'Aprano
On Wed, 26 Aug 2009 15:36:35 +, kj wrote: In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: Yeah, it's a little surprising that you can't access class scope from a function, but that has nothing to do with encapsulation. It

Re: quantiles of a student distribution

2009-08-26 Thread Colin J. Williams
Pierre wrote: Hello... Do you know how I can calculate the quantiles of a student distribution in pyhton ? Thanks You might look at: http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/special.html Colin W. -- http://mail.python.org/mailman/listinfo/python-list

Re: Object's nesting scope

2009-08-26 Thread zaur
On 26 авг, 17:13, Diez B. Roggisch de...@nospam.web.de wrote: Whom am we to judge? Sure if you propose this, you have some usecases in mind - how about you present these Ok. Here is a use case: object initialization. For example, person = Person(): name = john age = 30 address =

Re: Python on the Web

2009-08-26 Thread Phil
Thanks to everybody. I believe I am understanding things better. I have looked at the links that have been provided, although I have seen most of them in the past month or so that I've been looking into this stuff. I do agree with most of the things Armin stated in that NIH post. I agree with

Re: Object's nesting scope

2009-08-26 Thread Rami Chowdhury
person = Person(): name = john age = 30 address = Address(): street = Green Street no = 12 Can you clarify what you mean? Would that define a Person class, and an Address class? If you are expecting those classes to be already defined, please bear in mind that if you

Re: Need help with Python scoping rules

2009-08-26 Thread Ulrich Eckhardt
kj wrote: class Demo(object): def fact_iter(n): ret = 1 for i in range(1, n + 1): ret *= i return ret def fact_rec(n): if n 2: return 1 else: return n * fact_rec(n - 1) classvar1 = fact_iter(5)

Re: How does the file.seek() work ?

2009-08-26 Thread gert
On Aug 26, 12:46 am, Graham Dumpleton graham.dumple...@gmail.com wrote: On Aug 25, 5:37 am, Tim Chase python.l...@tim.thechases.com wrote: I want the file pointer set to 100 and overwrite everything from there [snip] def application(environ, response):    

Re: Need help with Python scoping rules

2009-08-26 Thread Terry Reedy
kj wrote: In 7figv3f2m3p0...@mid.uni-berlin.de Diez B. Roggisch de...@nospam.web.de writes: Classes are not scopes. Classes are objects. In particular, they are (by default) instances of class 'type'. Unless 'scopes' were instances of some other metaclass, the statement has to be true. I

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-26 Thread Mensanator
On Aug 26, 9:58 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Tue, 25 Aug 2009 11:45:28 -0700, Mensanator wrote: On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your

SimpleXMLRPCServer timeout issue

2009-08-26 Thread Mahi Haile
Hi all, I have an XML-RPC server running that is using SimpleXMLRPCServer, and I am trying to send a relatively large file on a poor connection [simulated low bandwidth, high latency]. The file is simply the return value of a function call available on the server. However, sometime in to the

Re: Need help with Python scoping rules

2009-08-26 Thread Ethan Furman
kj wrote: I have many years of programming experience, and a few languages, under my belt, but still Python scoping rules remain mysterious to me. (In fact, Python's scoping behavior is the main reason I gave up several earlier attempts to learn Python.) Here's a toy example illustrating

Re: Object's nesting scope

2009-08-26 Thread zaur
On 26 авг, 21:11, Rami Chowdhury rami.chowdh...@gmail.com wrote: person = Person():   name = john   age = 30   address = Address():      street = Green Street      no = 12 Can you clarify what you mean? Would that define a Person class, and an   Address class? I suppose that someone

Re: ubuntu dist-packages

2009-08-26 Thread Florian Diesch
Robin Becker ro...@reportlab.com writes: I was surprised a couple of days ago when trying to assist a colleage with his python setup on a ubuntu 9.04 system. We built our c-extensions and manually copied them into place, but site-packages wasn't there. It seems that ubuntu now wants stuff to

Re: Need help with Python scoping rules

2009-08-26 Thread kj
In 02a54597$0$20629$c3e8...@news.astraweb.com Steven D'Aprano st...@remove-this-cybersource.com.au writes: http://docs.python.org/reference/executionmodel.html It is also discussed in the PEP introducing nested scopes to Python: http://www.python.org/dev/peps/pep-0227/ It's even eluded to in

Re: Python Processor

2009-08-26 Thread John Nagle
Terry Reedy wrote: manish wrote: Hi, I am also wondering about how to implement a soft core reconfigurable processor in a FPGA which would directly execute the compiled python bytecode. It probably wouldn't help much. CPython's performance problems come from excessive dictionary

Re: quantiles of a student distribution

2009-08-26 Thread Robert Kern
On 2009-08-26 11:49 AM, Colin J. Williams wrote: Pierre wrote: Hello... Do you know how I can calculate the quantiles of a student distribution in pyhton ? Thanks You might look at: http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/special.html [Please pardon the piggybacking. I

ANN: ActivePython 3.1.1.2 is now available

2009-08-26 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 3.1.1.2 is now available for download from: http://www.activestate.com/activepython/python3/ This is a patch release that updates ActivePython to core Python 3.1.1 We recommend that you try 2.6 version first. See the release notes for full details:

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-26 Thread Evan Driscoll
On Aug 26, 10:15 am, Carl Banks pavlovevide...@gmail.com wrote: Well, it wouldn't be a can I rebind a variable using a with- statement thread if someone didn't post a solution that they thought worked, but didn't test it on local variables. I'm not going to deny it was pretty stupid... though

Re: Object's nesting scope

2009-08-26 Thread MRAB
zaur wrote: On 26 авг, 21:11, Rami Chowdhury rami.chowdh...@gmail.com wrote: person = Person(): name = john age = 30 address = Address(): street = Green Street no = 12 Can you clarify what you mean? Would that define a Person class, and an Address class? I suppose that

Re: pygtk - What is the best way to change the mouse pointer

2009-08-26 Thread MRAB
Ido Levy wrote: Hello All, I am writing a dialog which one of its widget is a gtk.ComboBoxEntry ( let's assume widget in the example below is its instance ) When the user select one of the values from the gtk.ComboBoxEntry I need to run some calculations that takes a few seconds. In order to

Re: Need help with Python scoping rules

2009-08-26 Thread Dave Angel
Carl Banks wrote: On Aug 26, 8:13 am, Dave Angel da...@ieee.org wrote: You can probably work around this by replacing the staticmethod decorator with an equivalent function call:. class Demo9(object): def fact(n): if n 2: return 1 else: return n

Re: Protecting against callbacks queuing up?

2009-08-26 Thread Esben von Buchwald
Hendrik van Rooyen wrote: would that be usable? Probably If so, how? This is a guess, for your device, but I suspect something along these lines: t = Ao_timer() cb = t.after(100,thing_that_does_the_work(with_its_arguments)) Lots of assumptions here - the 100 should give you a tenth of a

Re: Protecting against callbacks queuing up?

2009-08-26 Thread Esben von Buchwald
Dennis Lee Bieber wrote: On Tue, 25 Aug 2009 15:21:16 +0200, Esben von Buchwald find@paa.google declaimed the following in gmane.comp.python.general: This is how the accelerometer is accessed http://pys60.garage.maemo.org/doc/s60/node59.html I found this called after...

  1   2   >