Re: Write bits in file

2008-05-23 Thread Andrew Lee
Tim Roberts wrote: Monica Leko <[EMAIL PROTECTED]> wrote: I have a specific format and I need binary representation. Does Python have some built-in function which will, for instance, represent number 15 in exactly 10 bits? For the record, I'd like to point out that even C cannot do this. You

Re: Producing multiple items in a list comprehension

2008-05-23 Thread Peter Otten
Yves Dorfsman wrote: > Peter Otten <[EMAIL PROTECTED]> wrote: > >> > A slightly similar problem: If I want to "merge," say, list1=[1,2,3] >> > with list2=[4,5,6] to obtain [1,4,2,5,3,6], is there some clever way >> > with "zip" to do so? > >> >>> items = [None] * 6 >> >>> items[::2] = 1,2,3 >> >

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if python can do some kernel coding that used to be the private garden of C/C++. For e

error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread Marc Oldenhof
Hello all, I'm pretty new to Python, but use it a lot lately. I'm getting a crazy error trying to do operations on a string list after importing numpy. Minimal example: [start Python] Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright",

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-05-23 Thread Lie
On Apr 30, 8:57 pm, n00m <[EMAIL PROTECTED]> wrote: > >>> a = ['zzz', 'aaa'] > >>> id(a[0]), id(a[1]) > > (12258848, 12259296)>>> a.sort() > >>> id(a[0]), id(a[1]) > > (12259296, 12258848) > > That proves you know nothing, that is a list operation, not a string operation. -- http://mail.python.org

Re: Calling class method by name passed in variable

2008-05-23 Thread Bruno Desthuilliers
Sagari a écrit : Greetings, Can someone suggest an efficient way of calling method whose name is passed in a variable? method = getattr(obj, 'method_name', None) if callable(method): method(args) -- http://mail.python.org/mailman/listinfo/python-list

Re: error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread Marc Oldenhof
On 23 mei, 09:12, Marc Oldenhof <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm pretty new to Python, but use it a lot lately. I'm getting a crazy > error trying to do operations on a string list after importing numpy. > Minimal example: > > [start Python] > > Python 2.5.1 (r251:54863, Apr 18 2007,

Re: [Regexes] Stripping puctuation from a text

2008-05-23 Thread Andrew Lee
shabda raaj wrote: I want to strip punctuation from text. So I am trying, p = re.compile('[a-zA-Z0-9]+') p.sub('', 'I love tomatoes!! hell yeah! ... Why?') ' !! ! ... ?' Which gave me all the chars which I want to replace. So Next I tried by negating the regex, p = re.compile('^[a-zA-Z0

Re: where is the Write method of ElementTree??

2008-05-23 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > I'm messing around with trying to write an xml file using > xml.etree.ElementTree. All the examples on the internet show the use > of ElementTree.write(), although when I try to use it it's not > available, gives me ... > >ElementTree(sectionElement).write("section.

Python treeview and recursion: help needed

2008-05-23 Thread Mailing List SVR
Hi, I have a database with the following structure: idname sublevel for example 1 Node1 None 2 Node2 1 3 Node3 2 4 Node4 None 5 Node5 1 6 Node6 5 where Node1 and Node4 are treeview's master nodes, Node2 is a subnode of Node1, No

Re: php vs python

2008-05-23 Thread Michael Fesser
.oO(Nick Craig-Wood) >Damon Getsman <[EMAIL PROTECTED]> wrote: >> PHP has great support for accessing a MySQL database, > >Actually I'd say PHP's mysql support is lacking a very important >feature. mysql_query() doesn't support parameters (or placeholders, >usually '?') Where were you the last c

Re: error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread Gary Herron
Marc Oldenhof wrote: Hello all, I'm pretty new to Python, but use it a lot lately. I'm getting a crazy error trying to do operations on a string list after importing numpy. Minimal example: [start Python] Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Typ

Re: Relationship between GUI and logic?

2008-05-23 Thread Bruno Desthuilliers
John Salerno a écrit : I know that it is good programming practice to keep GUI and logic code physically separate, by using XRC for example, but I'm wondering if it's also good practice (and even possible) to keep them separate from an implementation standpoint as well. Basically what I mean is

Re: Python is slow

2008-05-23 Thread Bruno Desthuilliers
Brad a écrit : cm_gui wrote: Python is slow. It ain't C++, but it ain't a punch card either... somewhere in between. I find it suitable for lots of stuff. I use C++ when performance really matters tho... right tool for the job. Learn a good interpreted language (Pyhton) and a good compiled

pickle error: can't pickle instancemethod objects

2008-05-23 Thread Michele Simionato
Can somebody explain what's happening with the following script? $ echo example.py import pickle class Example(object): def __init__(self, obj, registry): self._obj = obj self._registry = registry for name, func in self._registry.iteritems(): setattr(self,

Re: MVC

2008-05-23 Thread Bruno Desthuilliers
George Maggessy a écrit : Hi Gurus, I'm a Java developer and I'm trying to shift my mindset to start programming python. Welcome onboard then. So, my first exercise is to build a website. However I'm always falling back into MVC pattern. And ? Is there anything wrong with web-style MVC ?

Re: 2 different versions of python compiling files.

2008-05-23 Thread Ivan Illarionov
> The original .py will always be there but you know what, multiple python > versions from different computers do access that one library at the same > time. > > Anyone know a possible solution ? What about subversion or mercurial and separate copies of your library for each Python version? --

Re: webcam (usb) access under Ubuntu

2008-05-23 Thread ticapix
On 16 avr, 09:41, Berco Beute <[EMAIL PROTECTED]> wrote: > On Apr 15, 11:45 pm, Berco Beute <[EMAIL PROTECTED]> wrote: > > > I've tried reinstalling gstreamer (for windows): > > >http://gstreamer.freedesktop.org/pkg/windows/releases/gstreamer/gstre.. > > > but that didn't help. I get some compl

Re: error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread Peter Otten
Marc Oldenhof wrote: > I'm pretty new to Python, but use it a lot lately. I'm getting a crazy > error trying to do operations on a string list after importing numpy. > Minimal example: > > [start Python] > > Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit > (Intel)] on win32

Re: Decorator metaclass

2008-05-23 Thread Carl Banks
On May 22, 10:28 pm, [EMAIL PROTECTED] wrote: > Hi, > I would like to create a Decorator metaclass, which automatically > turns a class which inherits from the "Decorator" type into a > decorator. > A decorator in this case, is simply a class which has all of its > decorator implementation inside a

Re: pickle error: can't pickle instancemethod objects

2008-05-23 Thread Peter Otten
Michele Simionato wrote: > Can somebody explain what's happening with the following script? > def __gestate__(self): # should skip the bound methods attributes Must be __getstate__ ;) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Flaming Thunder

2008-05-23 Thread Iain King
On May 23, 3:35 am, Charles Hixson <[EMAIL PROTECTED]> wrote: > On Thursday 22 May 2008 13:30:07 Nick Craig-Wood wrote: > > > ... > > >From Armstrong's book: The expression Pattern = Expression causes > > > Expression to be evaluated and the result matched against Pattern. The > > match either succ

Re: error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread I V
On Fri, 23 May 2008 00:12:35 -0700, Marc Oldenhof wrote: > It seems that Python calls numpy's "all" instead of the standard one, is > that right? If so, how can I call the standard "all" after the numpy > import? ["import numpy" is not a desirable option, I use a lot of math > in my progs] I think

Re: pickle error: can't pickle instancemethod objects

2008-05-23 Thread Michele Simionato
On May 23, 10:12 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Michele Simionato wrote: > > Can somebody explain what's happening with the following script? > >     def __gestate__(self): # should skip the bound methods attributes > > Must be __getstate__ ;) > > Peter Aaargh!!! I spent a couple of

Ploneboard - grouping forums and setting up on disk

2008-05-23 Thread Paul Rudin
I'm investigating using ploneboard and have a couple of questions. First of all I don't quite get what the global view/local view distinction is - perhaps someone could be good enough to explain what it's for. If it possible to group forums so that permissions can be applied to each set so - for

Re: Python is slow

2008-05-23 Thread Carl Banks
On May 23, 3:50 am, Bruno Desthuilliers wrote: > Brad a écrit : > > > cm_gui wrote: > >> Python is slow. > > > It ain't C++, but it ain't a punch card either... somewhere in between. > > I find it suitable for lots of stuff. I use C++ when performance really > > matters tho... right tool for the

KeyError in pickle

2008-05-23 Thread christof
Hi, I am using pickle/unpickle to let my program save its documents to disk. While this it worked stable for a long time, one of my users now complained, that he had a file which can't be loaded. The traceback is: File "pickle.pyo", line 1374, in loads File "pickle.pyo", line 858, in loa

Google Treasure solution in python - first time python user, help whats wrong

2008-05-23 Thread x40
I try to learn python thru solving some interisting problem, found google trasure hunt, write first program ( but cant find whats wrong). # Unzip the archive, then process the resulting files to obtain a numeric result. You'll be taking the sum of lines from files matching a certain description, a

Re: pyserial and file open conflict?

2008-05-23 Thread Peter
On 15 Maj, 19:37, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-05-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I have a small but rather annoying problem withpyserial. I want to > > open a file on disk for reading and then open a com-port, write lines > > from the file to the port a

Re: Python and Flaming Thunder

2008-05-23 Thread Duncan Booth
Brian Quinlan <[EMAIL PROTECTED]> wrote: > Dave Parker wrote: >>> Or just: >>> >>> If command is "quit" ... >> >> Hmmm. In Flaming Thunder, I'm using "is" (and "is an", "is a", etc) >> for assigning and checking types. For example, to read data from a >> file and check for errors: >> >> R

Re: Python is slow

2008-05-23 Thread inhahe
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brad a écrit : >> cm_gui wrote: >>> Python is slow. >> >> It ain't C++, but it ain't a punch card either... somewhere in between. I >> find it suitable for lots of stuff. I use C++ when performance really >> ma

Re: error using all()/numpy [TypeError: cannot perform reduce with flexible type]

2008-05-23 Thread Marc Oldenhof
On 23 mei, 09:12, Marc Oldenhof <[EMAIL PROTECTED]> wrote: Thanks for the reactions, I'll use the "from numpy import " from now on :) Marc -- http://mail.python.org/mailman/listinfo/python-list

Re: KeyError in pickle

2008-05-23 Thread Peter Otten
christof wrote: > I am using pickle/unpickle to let my program save its documents to > disk. While this it worked stable for a long time, one of my users now > complained, that he had a file which can't be loaded. > > The traceback is: > > File "pickle.pyo", line 1374, in loads > File "p

Re: can python do some kernel stuff?

2008-05-23 Thread Jimmy
On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: > Jimmy wrote: > > Hi to all > > > python now has grown to a versatile language that can > > accomplish tasks for many different purposes. However, > > AFAIK, little is known about its ability of kernel coding. > > > So I am wondering if pyt

Re: Python and Flaming Thunder

2008-05-23 Thread Nick Craig-Wood
I V <[EMAIL PROTECTED]> wrote: > On Thu, 22 May 2008 19:35:50 -0700, Charles Hixson wrote: > > Although when comparing Candygram with Erlang it's worth noting that > > Candygram is bound to one processor, where Erlang can operate on > > multiple processors. (I'd been planning on using Candygram fo

Re: Calling class method by name passed in variable

2008-05-23 Thread Nick Craig-Wood
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > Can someone suggest an efficient way of calling method whose name is > > passed in a variable? > > > > method = getattr(obj, 'method_name', None) > if callable(method): > method(args) I think that that is needless LBYL... getattr(obj

online money earnings

2008-05-23 Thread dasasdfd
online money earnings value of money money is the life http://moneylife0123.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: php vs python

2008-05-23 Thread Andrew Lee
notbob wrote: I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delimna: I want to start a

unittest: Calling tests in liner number order

2008-05-23 Thread Antoon Pardon
Some time ago I asked whether is would be possible that unittest would perform the test in order of appearence in the file. The answers seemed to be negative. Since I really would like this behaviour I took the trouble of looking throught the source and I think I found a minor way to get this beha

Re: pyserial and file open conflict?

2008-05-23 Thread Diez B. Roggisch
Do you have to much time? Maybe you have enough time to read this: http://www.catb.org/~esr/faqs/smart-questions.html Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread Nick Craig-Wood
bukzor <[EMAIL PROTECTED]> wrote: > That does, in fact work. Thanks! I'm a little sad that there's no > builtin way to do it, owell. > > >>> def f(a, *args): > ... print a > ... for b in args: print b > ... > >>> import inspect > >>> a = [2,3] > >>> b = {'a':1} > >>> inspect.getargspe

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Jimmy wrote: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if python can d

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I a

Re: Python is slow

2008-05-23 Thread Ivan Illarionov
On 23 май, 02:20, Brad <[EMAIL PROTECTED]> wrote: > cm_gui wrote: > > Python is slow. > > It ain't C++, but it ain't a punch card either... somewhere in between. > I find it suitable for lots of stuff. I use C++ when performance really > matters tho... right tool for the job. Learn a good interp

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread inhahe
"Nick Craig-Wood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > bukzor <[EMAIL PROTECTED]> wrote: >> That does, in fact work. Thanks! I'm a little sad that there's no >> builtin way to do it, owell. >> >> >>> def f(a, *args): >> ... print a >> ... for b in args: print

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if python can

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if we assume the constraints are that: > 1.he has list, l > 2.he has a dictionary, d > 3.he wants the function to print the values in the dictionary according to > a specific order of their keys as defined by the function, f

Re: ctypes help

2008-05-23 Thread Nick Craig-Wood
gianluca <[EMAIL PROTECTED]> wrote: > On 23 Mag, 07:48, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > On Thu, 22 May 2008 21:55:41 -0700, gianluca wrote: > > > Yes, I know it but when I load a function (a=myDLL.myFUNCT()) I've an > > > exception like this: > > > > > Traceback (most recen

Re: Python is slow

2008-05-23 Thread Paul Rubin
"inhahe" <[EMAIL PROTECTED]> writes: > planets are spherical (all implementations of Python are not natively > compiled (and you said for whatever definition)), and b) It's a far cry to > imagine a planet coming into being that's not spherical (a language as > dynamic as Python, or most other sc

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
Andrew Lee schrieb: Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of

Re: Why is math.pi slightly wrong?

2008-05-23 Thread Nick Craig-Wood
Jerry Hill <[EMAIL PROTECTED]> wrote: > On Thu, May 22, 2008 at 12:32 PM, Dutton, Sam <[EMAIL PROTECTED]> wrote: > > I've noticed that the value of math.pi -- just entering it at the > > interactive prompt -- is returned as 3.1415926535897931, whereas (as every > > pi-obsessive knows) the value

Re: Relationship between GUI and logic?

2008-05-23 Thread inhahe
> >> To be more specific, let's say I want to create a simple, 2D strategy >> game. It will have a board layout like chess or checkers and the player >> will move around the board. Let's say this is all I know, and perhaps I >> don't even know *this* for sure either. Is it possible to write the >>

Re: can python do some kernel stuff?

2008-05-23 Thread Andrew Lee
Diez B. Roggisch wrote: Andrew Lee schrieb: Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is kn

Re: php vs python

2008-05-23 Thread Erwin Moller
Andrew Lee schreef: notbob wrote: I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my del

Re: php vs python

2008-05-23 Thread Jerry Stuckle
inhahe wrote: PHP can do that. There are also a number of templating engines available. The nice thing about PHP is you have a choice. i just meant that php is sort of invented to combine html and code, so if you use python instead you should use a templating engine. but i suppose it's use

Re: php vs python

2008-05-23 Thread Jerry Stuckle
Andrew Lee wrote: notbob wrote: I'm not posting this just to initiate some religious flame war, though it's the perfect subject to do so. No, I actaully want some serious advice about these two languages and since I think usenet is the best arena to find it, here ya' go. So, here's my delim

RE: Why is math.pi slightly wrong?

2008-05-23 Thread Dutton, Sam
Thanks for all the answers and comments. >math.pi is exactly equal to 884279719003555/281474976710656, which is the >closest C double to the actual value of pi So much for poor old 22/7... Sam SAM DUTTON SENIOR SITE DEVELOPER 200 GRAY'S INN ROAD LONDON WC1X 8XZ UNITED KINGDOM T +44 (0)2

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
OP: "I am wondering if python can do some kernel coding that used to be the private garden of C/C++." "kernel coding" is pretty clear I'd say - coding a or in the kernel. Not coding that runs on an OS that happens to have a kernel. The answer is yes. IPC and py-pf are examples. If you don'

Re: php vs python

2008-05-23 Thread Michael Fesser
.oO(Andrew Lee) >Personally, I believe PHP would get you more productive more quickly for >a blog, but it is a potentially brain damaging language in terms of >really getting your juices flowing with programming. It is not a >general purpose language Please elaborate. >and suffers from all t

Re: where is the Write method of ElementTree??

2008-05-23 Thread gray . bowman
On May 23, 3:22 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'm messing around with trying to write an xml file using > > xml.etree.ElementTree. All the examples on the internet show the use > > of ElementTree.write(), although when I try to use it it's not > > avai

Re: php vs python

2008-05-23 Thread Duncan Booth
Erwin Moller <[EMAIL PROTECTED]> wrote: > Why do you say it 'tastes less' then Python? > I don't want to start a religious war, but am curious. > Who knows, maybe I'll dump PHP and start using Python after your > answer. ;-) I may not be a good person to answer this since I don't know PHP: I d

Re: Calling class method by name passed in variable

2008-05-23 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Can someone suggest an efficient way of calling method whose name is passed in a variable? method = getattr(obj, 'method_name', None) if callable(method): method(args) I think that that is needless LBYL... Fro

Re: Books for learning how to write "big" programs

2008-05-23 Thread Simon Brunning
On Thu, May 22, 2008 at 4:55 PM, duli <[EMAIL PROTECTED]> wrote: > Hi: > I would like recommendations for books (in any language, not > necessarily C++, C, python) which have walkthroughs for developing > a big software project ? So starting from inception, problem > definition, design, coding and

Re: Python is slow

2008-05-23 Thread Bruno Desthuilliers
Carl Banks a écrit : (snip technically pedantic correction) You know, even though you're technically correct, I'd like to see you abandon this little crusade. At this point it's more noisy than helpful. (snip) Mmm... You're probably right. I tend to be way too pedantic sometimes. OTHO, there

Re: php vs python

2008-05-23 Thread Michael Fesser
.oO(Duncan Booth) >On those rare occasions when I've helped someone who wanted advice I've >found that my Python oriented viewpoint can be quite hard to translate to >PHP. For example I'd suggest 'oh you just encode that as utf8' only to be >told that there's no easy way to do that (have just G

Advice from senior Members

2008-05-23 Thread flit
Hello All, I am looking for some experience from the senior members. Now I am doing a simple desktop application, this application will have 3 main functions: 1- Read information about the desktop system; 2- Interact with the user; 3- Send information to a server. The first part, reading informa

Re: Relationship between GUI and logic?

2008-05-23 Thread Marc 'BlackJack' Rintsch
On Fri, 23 May 2008 07:14:08 -0400, inhahe wrote: > If the GUI defines that it's a board layout like chess or > checkers and the player will move around the board, it's hard to say what's > left for the "logic" part to do. The logic part has the rules how you may move the pieces. The GUI shoul

Re: Relationship between GUI and logic?

2008-05-23 Thread John Salerno
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ever heard of the "Model/View/Controller" pattern ? Yes, I have, but I probably don't understand it well enough yet. For example, I don't really know what is meant by phrases like "build a model", "the view reg

WXpython Question

2008-05-23 Thread Gandalf
I try to reach a specific wx StaticText element's text and to change it by clicking on a button now let's say the this is my element: wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE) And this is my EVT_BUTTON bind function : def OnClick(event): which code shude i enter to

Re: Advice from senior Members

2008-05-23 Thread Mike Driscoll
On May 23, 8:02 am, flit <[EMAIL PROTECTED]> wrote: > Hello All, > > I am looking for some experience from the senior members. > Now I am doing a simple desktop application, this application will > have 3 main functions: > > 1- Read information about the desktop system; > 2- Interact with the user;

Re: WXpython Question

2008-05-23 Thread Mike Driscoll
On May 23, 8:24 am, Gandalf <[EMAIL PROTECTED]> wrote: > I try to reach a specific wx StaticText element's text and to change > it by clicking on a button > > now let's say the this is my element: > > wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE) > > And this is my EVT_BUTTON

Re: Calling class method by name passed in variable

2008-05-23 Thread Nick Craig-Wood
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood a ?crit : > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>> Can someone suggest an efficient way of calling method whose name is > >>> passed in a variable? > >>> > >> method = getattr(obj, 'method_name', None) > >> if calla

Re: WXpython Question

2008-05-23 Thread Gandalf
On May 23, 3:29 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 8:24 am, Gandalf <[EMAIL PROTECTED]> wrote: > > > I try to reach a specific wx StaticText element's text and to change > > it by clicking on a button > > > now let's say the this is my element: > > > wx.StaticText(panel, 15,

Re: KeyError in pickle

2008-05-23 Thread christof
On 23 Mai, 10:48, Peter Otten <[EMAIL PROTECTED]> wrote: > christof wrote: > > I am using pickle/unpickle to let my program save its documents to > > disk. While this it worked stable for a long time, one of my users now > > complained, that he had a file which can't be loaded. > > > The traceback

Re: Why is math.pi slightly wrong?

2008-05-23 Thread J. Cliff Dyer
On Thu, 2008-05-22 at 15:06 -0400, Dan Upton wrote: > Who wants to verify that that's correct to that many digits? ;) Verified. I checked it against the million digits on piday.org, by putting each into a string, stripping out spaces and newlines, and doing: >>> piday[:len(clpy)] == clpy False >

Re: Python treeview and recursion: help needed

2008-05-23 Thread Mailing List SVR
Il giorno ven, 23/05/2008 alle 09.20 +0200, Mailing List SVR ha scritto: > Hi, > > I have a database with the following structure: > > idname sublevel > > for example > > 1 Node1 None > 2 Node2 1 > 3 Node3 2 > 4 Node4 None > 5 Node5 1 > 6 Node6

Re: Python is slow

2008-05-23 Thread Grant Edwards
On 2008-05-23, RPM1 <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: >> If your Python program is slow, you have almost assuredly >> approached it with a wrong method or algorithm. > > I agree for most applications. There are however times where > Python just isn't fast enough, and that's usually w

Re: Python is slow

2008-05-23 Thread Eric Brunel
On Fri, 23 May 2008 12:48:56 +0200, > wrote: "inhahe" <[EMAIL PROTECTED]> writes: planets are spherical (all implementations of Python are not natively compiled (and you said for whatever definition)), and b) It's a far cry to imagine a planet coming into being that's not spherical (a langua

Genuine Lifetime Income!! Earn!! = 10,000 US Dollars per month without Investmen

2008-05-23 Thread cashm491
You Have Finally Found It Genuine Lifetime Income!! Earn!! à 10,000 US Dollars per month without Investment http://seniorfriendfinder.com/go/g970599-pmem Earn!! à 10,000 US Dollars per month without Investment By working only one hour per day from the cyber café or PC -- http://mail.python.org/mail

Re: pyserial and file open conflict?

2008-05-23 Thread Grant Edwards
On 2008-05-23, Peter <[EMAIL PROTECTED]> wrote: > On 15 Maj, 19:37, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2008-05-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > I have a small but rather annoying problem withpyserial. I want to >> > open a file on disk for reading and then open a

Re: php vs python

2008-05-23 Thread Duncan Booth
Michael Fesser <[EMAIL PROTECTED]> wrote: > .oO(Duncan Booth) > >>On those rare occasions when I've helped someone who wanted advice >>I've found that my Python oriented viewpoint can be quite hard to >>translate to PHP. For example I'd suggest 'oh you just encode that as >>utf8' only to be told

Re: Producing multiple items in a list comprehension

2008-05-23 Thread Yves Dorfsman
Peter Otten <[EMAIL PROTECTED]> wrote: > The speed gain is significant. Why should I throw away useful information if > I have it? My thinking was that it wasn't generic enough, and I was looking for a solution that would work for more generic problem. I agree, I shouldn't have used the world "e

Re: Code For Five Threads To Process Multiple Files?

2008-05-23 Thread tdahsu
On May 23, 12:20 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 22 May 2008 11:03:48 -0700 (PDT), [EMAIL PROTECTED] declaimed the > following in comp.lang.python: > > > Ah, well, I didn't get any other responses, but here's what I've done: > >         Apparently the direct email from my

Re: Misuse of list comprehensions?

2008-05-23 Thread duncan smith
Simon Forman wrote: On May 21, 4:36 am, Bruno Desthuilliers wrote: Simon Forman a écrit : On May 20, 8:58 am, Paul McGuire <[EMAIL PROTECTED]> wrote: On May 20, 10:50 am, [EMAIL PROTECTED] wrote: You don't need all those conditionals. A set differs from a list precisely in the fact that e

Re: Relationship between GUI and logic?

2008-05-23 Thread Bruno Desthuilliers
John Salerno a écrit : "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Ever heard of the "Model/View/Controller" pattern ? Yes, I have, but I probably don't understand it well enough yet. For example, I don't really know what is meant by phrases like "build

Re: php vs python

2008-05-23 Thread Michael Fesser
.oO(Duncan Booth) >Michael Fesser <[EMAIL PROTECTED]> wrote: > >> The only little problem is that PHP doesn't have native Unicode >> support yet, which will change with PHP 6. But of course you can still >> use UTF-8 without any trouble, I do it all the time. You just have to >> keep in mind that

Re: Relationship between GUI and logic?

2008-05-23 Thread David C. Ullrich
On Fri, 23 May 2008 09:13:50 -0400, "John Salerno" <[EMAIL PROTECTED]> wrote: >"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in >message news:[EMAIL PROTECTED] >> Ever heard of the "Model/View/Controller" pattern ? > >Yes, I have, but I probably don't understand it well enough yet. For >exampl

Re: unittest: Calling tests in liner number order

2008-05-23 Thread John Roth
On May 23, 3:36 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Some time ago I asked whether is would be possible that unittest would > perform the test in order of appearence in the file. > > The answers seemed to be negative. Since I really would like this > behaviour I took the trouble of lookin

Re: Database Query Contains Old Data

2008-05-23 Thread John Nagle
Paul Boddie wrote: On 21 Mai, 15:22, [EMAIL PROTECTED] wrote: I did and I confirmed this by modifying the data, selecting it from the mysql command line client to verify the changes, then running the report again. If I exit the application and then start it again, everything works as expected un

Re: can python do some kernel stuff?

2008-05-23 Thread Jimmy
On May 23, 5:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Jimmy schrieb: > > > On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: > >> Jimmy wrote: > >>> Hi to all > >>> python now has grown to a versatile language that can > >>> accomplish tasks for many different purposes. Howeve

Re: unittest: Calling tests in liner number order

2008-05-23 Thread Quentin Gallet-Gilles
I personally don't see any benefit in this approach. By definition, unittests should be independent, so the order argument suggests a deeper issue. What's your use case ? Quentin On Fri, May 23, 2008 at 11:36 AM, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Some time ago I asked whether is would

Re: can python do some kernel stuff?

2008-05-23 Thread Jimmy
On May 23, 11:14 pm, Jimmy <[EMAIL PROTECTED]> wrote: > On May 23, 5:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > Jimmy schrieb: > > > > On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: > > >> Jimmy wrote: > > >>> Hi to all > > >>> python now has grown to a versatile lang

How to print a sorted list as a multi-column table

2008-05-23 Thread Sverker Nilsson
Hi all, I would like to ask about opinions about the best way to format sorted tables of items for interactive use. I have begun to add interactive help to Guppy/Heapy (http://guppy-pe.sourceforge.net) because it lacks the usual ways for introspection (see for example http://www.pkgcore.org/trac/p

Re: Producing multiple items in a list comprehension

2008-05-23 Thread Paul Hankin
On May 22, 7:21 pm, "Joel Koltner" <[EMAIL PROTECTED]> wrote: > Is there an easy way to get a list comprehension to produce a flat list of, > say, [x,2*x] for each input argument? > > E.g., I'd like to do something like: > > [ [x,2*x] for x in range(4) ] [x * i for x in xrange(4) for i in xrange(1

Re: Python is slow

2008-05-23 Thread Brian Blais
On May 23, 2008, at May 23:10:11 AM, Grant Edwards wrote: On 2008-05-23, RPM1 <[EMAIL PROTECTED]> wrote: Larry Bates wrote: If your Python program is slow, you have almost assuredly approached it with a wrong method or algorithm. I agree for most applications. There are however times where

Another Question

2008-05-23 Thread Gandalf
How can i bind function that handle the mouse clicking window X event or clicking alt+F4 thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator metaclass

2008-05-23 Thread Thomas Karolski
Thanks for pointing out all those mistakes. I think I'm already starting to grasp all of the python magic going on in there. Parenthetical: I don't normally recommend this style, since it obscures the fact that you're using a custom metaclass to the user. That is something the user probably wou

Re: Relationship between GUI and logic?

2008-05-23 Thread Bruno Desthuilliers
David C. Ullrich a écrit : On Fri, 23 May 2008 09:13:50 -0400, "John Salerno" <[EMAIL PROTECTED]> wrote: "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Ever heard of the "Model/View/Controller" pattern ? Yes, I have, but I probably don't understand it well en

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread bukzor
On May 23, 3:29 am, "inhahe" <[EMAIL PROTECTED]> wrote: > "inhahe" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > if we assume the constraints are that: > > 1.he has list, l > > 2.he has a dictionary, d > > 3.he wants the function to print the values in the dictionary accordi

Re: Another Question

2008-05-23 Thread Mike Driscoll
On May 23, 10:45 am, Gandalf <[EMAIL PROTECTED]> wrote: > How can i bind function that handle the mouse clicking  window X event > or clicking alt+F4 > > thanks You really need to learn to ask good questions. Unless people dive into your previous posts, they won't know what Python GUI toolkit you

  1   2   >