Re: max(), sum(), next()

2008-09-03 Thread Steven D'Aprano
On Wed, 03 Sep 2008 22:20:43 -0700, Mensanator wrote: > On Sep 3, 8:30�pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: >> sum([]) >> > 0 >> >> > is a bug, just as it's a bug in Excel to evaluate blank cells as 0. >>

Re: max(), sum(), next()

2008-09-03 Thread Fredrik Lundh
Mensanator wrote: No it isn't. Nothing is not 0, check with MS-Access, for instance: Null + 1 returns Null. Any arithmetic expression involving a Null evaluates to Null. Adding something to an unknown returns an unknown, as it should. It is a logical fallacy to equate unknown with 0. http://

Re: max(), sum(), next()

2008-09-03 Thread Mensanator
On Sep 4, 12:20�am, Mensanator <[EMAIL PROTECTED]> wrote: > On Sep 3, 8:30 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: > > sum([]) > > > 0 > > > > is a bug, just as it's a bug in Excel to evaluate blank cells a

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Kay Schluehr
On 3 Sep., 18:34, Michael Palmer <[EMAIL PROTECTED]> wrote: > As anyone knows, the state of Python GUI programming is a little > fractured at this time, with many toolkits, wrappers and meta-wrappers > dead and alive, with or without documentation. A few thoughts. 1) This topic is discussed here

Re: max(), sum(), next()

2008-09-03 Thread Mensanator
On Sep 3, 8:30�pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: > sum([]) > > 0 > > > is a bug, just as it's a bug in Excel to evaluate blank cells as 0. It > > should return None or throw an exception like sum([None,1])

Download movies

2008-09-03 Thread [EMAIL PROTECTED]
Download movies http://gpirate.com http://www.gpirate.com/search?hl=en&q=naruto+shippuden&btnG=Search -- http://mail.python.org/mailman/listinfo/python-list

what is next for you, a great opportunity waiting for

2008-09-03 Thread king
www.hrconsultant.tk -- http://mail.python.org/mailman/listinfo/python-list

Re: max(), sum(), next()

2008-09-03 Thread Luis Zarrabeitia
Quoting Laszlo Nagy <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] wrote: > > Empty Python lists [] don't know the type of the items it will > > contain, so this sounds strange: > > > > > sum([]) > > > 0 > > > > Because that [] may be an empty sequence of someobject: > > > > Y

Re: Late initialization using __getattribute__

2008-09-03 Thread Michele Simionato
On Sep 4, 12:26 am, bukzor <[EMAIL PROTECTED]> wrote: > I'm trying to optimize my number of connections by not fully > initializing (read: not connecting) my connection until it's used in > some way. I had the same use case and I solved with a simple property. Here is the code I have for pymssql:

Re: email.Message problem

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 07:36:30 -0300, Corrado Gioannini <[EMAIL PROTECTED]> escribi�: On Tue, Sep 02, 2008 at 04:50:15PM -0300, Gabriel Genellina wrote: > messg = email.message.Message() Replace this line with: messg = email.mime.multipart.MIMEMultipart() *OR* Set the Content-Type header to "m

Re: Help Understanding weakref (lazyloader)

2008-09-03 Thread Ripter
On Sep 3, 10:46 pm, Ripter <[EMAIL PROTECTED]> wrote: > I found this script > athttp://www.pygame.org/wiki/LazyImageLoading?parent=CookBook > And I can't quite figure out how it works. I was wondering if someone > could clarify it for me. > The Code is: > > import pygame > import weakref > > class

Help Understanding weakref (lazyloader)

2008-09-03 Thread Ripter
I found this script at http://www.pygame.org/wiki/LazyImageLoading?parent=CookBook And I can't quite figure out how it works. I was wondering if someone could clarify it for me. The Code is: import pygame import weakref class ResourceController(object): def __init__(self, loader): se

Re: Access to Windows "Add/Remove Programs"?

2008-09-03 Thread Sean DiZazzo
On Sep 3, 7:13 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 03 Sep 2008 21:51:59 -0300, Sean DiZazzo <[EMAIL PROTECTED]>   > escribi : > > > I'm trying to find a way to get a list of all the installed programs > > on a Windows box via Python.  I thought of a few hacks that might > >

RE: Numeric literal syntax

2008-09-03 Thread Delaney, Timothy (Tim)
Steven D'Aprano wrote: > On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: > >> It seems to me that the right choice for thousands seperator is the >> apostrophe. > > You mean the character already used as a string delimiter? Hey - I just found a new use for the backtick! 123`456`7

Re: Submitting forms over HTTPS with mechanize

2008-09-03 Thread Larry Bates
Rex wrote: Hello, I am working on an academic research project where I need to log in to a website (www.lexis.com) over HTTPS and execute a bunch of queries to gather a data set. I just discovered the mechanize module, which seems great because it's a high-level tool. However, I can't find any d

Re: Access to Windows "Add/Remove Programs"?

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 21:51:59 -0300, Sean DiZazzo <[EMAIL PROTECTED]> escribi�: I'm trying to find a way to get a list of all the installed programs on a Windows box via Python. I thought of a few hacks that might partially work, and then thought about "Add/Remove Programs" Seems like the rig

Re: Access to Windows "Add/Remove Programs"?

2008-09-03 Thread Larry Bates
Sean DiZazzo wrote: Hi all, I'm trying to find a way to get a list of all the installed programs on a Windows box via Python. I thought of a few hacks that might partially work, and then thought about "Add/Remove Programs" Seems like the right way to go. I looked over the pywin32 docs a bit,

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 21:34:35 -0300, Derek Martin <[EMAIL PROTECTED]> escribi�: On Wed, Sep 03, 2008 at 03:16:00PM -0700, Dennis Lee Bieber wrote: On Wed, 3 Sep 2008 03:09:18 -0400, Derek Martin <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > struct run { >int speed; >

Submitting forms over HTTPS with mechanize

2008-09-03 Thread Rex
Hello, I am working on an academic research project where I need to log in to a website (www.lexis.com) over HTTPS and execute a bunch of queries to gather a data set. I just discovered the mechanize module, which seems great because it's a high-level tool. However, I can't find any decent documen

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Greg Ewing
Michael Palmer wrote: So far, development of PyGUI seems to be a one-man effort, and it may be slowed down by the attempt to develop the API and the implementations concurrently. Could it be useful to uncouple the two, such that the API would be specified ahead of the implementation? I'm not s

Re: sys.stdin on windows

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 07:16:12 -0300, Tim Golden <[EMAIL PROTECTED]> escribi�: Gabriel Genellina wrote: En Wed, 03 Sep 2008 06:16:03 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribi�: When I try to run the same thing on windows I get IOError: [Error 9] Bad file descriptor How can I make

Re: Numeric literal syntax

2008-09-03 Thread Steven D'Aprano
On Thu, 04 Sep 2008 01:22:22 +0100, Alexander Schmolck wrote: > It seems to me that the right choice for thousands seperator is the > apostrophe. You mean the character already used as a string delimiter? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: max(), sum(), next()

2008-09-03 Thread Steven D'Aprano
On Wed, 03 Sep 2008 16:20:39 -0700, Mensanator wrote: sum([]) > 0 > > is a bug, just as it's a bug in Excel to evaluate blank cells as 0. It > should return None or throw an exception like sum([None,1]) does. You're wrong, because 99.9% of the time when users leave a blank cell in Excel, t

Re: Numeric literal syntax

2008-09-03 Thread bearophileHUGS
Alexander Schmolck: > It also reads well, unlike the underscore > which is visually obstrusive and ugly (compare 123'456'890 to 123_456_789). I like that enough, in my language that symbol is indeed the standard one to separate thousands, in large numbers. It's light, looks natural, and as you say

Access to Windows "Add/Remove Programs"?

2008-09-03 Thread Sean DiZazzo
Hi all, I'm trying to find a way to get a list of all the installed programs on a Windows box via Python. I thought of a few hacks that might partially work, and then thought about "Add/Remove Programs" Seems like the right way to go. I looked over the pywin32 docs a bit, but nothing slapped me

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Derek Martin
On Wed, Sep 03, 2008 at 03:16:00PM -0700, Dennis Lee Bieber wrote: > On Wed, 3 Sep 2008 03:09:18 -0400, Derek Martin <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > struct run { > > int speed; > > direction_type direction; > > }; > > > > Not a function. Desc

Re: Help with Tkinter Label Widget

2008-09-03 Thread Guilherme Polo
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <[EMAIL PROTECTED]> wrote: > Below i've put the code for a program that i wrote. I need help on lines > 384-403. If you run this program you will notice on the first tab when have > it produce an answer the $ is surrounded with {$}. How can i get

Re: Numeric literal syntax

2008-09-03 Thread Alexander Schmolck
Ben Finney <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: > >> For Python 2.7/3.1 I'd now like to write a PEP regarding the >> underscores into the number literals, like: 0b_0101_, 268_435_456 >> etc. > > +1 on such a capability. > > -1 on underscore as the separator. > > When you pro

Help with Tkinter Label Widget

2008-09-03 Thread Kevin McKinley
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with {$}. How can i get rid of that? from Tkinter import * class MyApp: def __init__(self, paren

Re: max(), sum(), next()

2008-09-03 Thread castironpi
On Sep 3, 7:48 am, [EMAIL PROTECTED] wrote: > Empty Python lists [] don't know the type of the items it will > contain, so this sounds strange: > > >>> sum([]) > > 0 > > Because that [] may be an empty sequence of someobject: > > >>> sum(s for s in ["a", "b"] if len(s) > 2) > > 0 > > In a staticall

Re: Writing Unicode to database using ODBC

2008-09-03 Thread John Machin
On Sep 4, 3:11 am, Mudcat <[EMAIL PROTECTED]> wrote: [snip] > However, now that I've got all that working I'd like to simply take > the unicode data from the xml parser and then pass it directly into > the database (which is currently set up for unicode data). I've run What database? What does "s

Re: max(), sum(), next()

2008-09-03 Thread Mensanator
On Sep 3, 2:18 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Empty Python lists [] don't know the type of the items it will > > contain, so this sounds strange: > > sum([]) > > > 0 > > > Because that [] may be an empty sequence of someobject: > > You are right in th

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 19:38:13 Bruno Desthuilliers, vous avez écrit : > FWIW, if there's no computation on getting or setting value, you can > make it a plain attribute. Yes, this is the problem with these tiny examples, we don't know at which point we must simplify them... > > But whil

Re: max(), sum(), next()

2008-09-03 Thread bearophileHUGS
Laszlo Nagy: > I believe that there have been excessive discussions about this > decision, and the current implementation is very good, if not the best. I see. But note that my post is mostly about the max()/min() functions :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-lis

Re: max(), sum(), next()

2008-09-03 Thread MRAB
On Sep 3, 8:18 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Empty Python lists [] don't know the type of the items it will > > contain, so this sounds strange: > > sum([]) > > > 0 > > > Because that [] may be an empty sequence of someobject: > > You are right in th

xml + mmap cross

2008-09-03 Thread castironpi
Any interest in pursuing/developing/working together on a mmaped-xml class? Faster, not readable in text editor. -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a similar object from an derived class

2008-09-03 Thread MRAB
On Sep 3, 8:09 pm, Scott <[EMAIL PROTECTED]> wrote: > Let's say I have an object: > > class foo(): >    def create_another() >        return foo() > >    def blah(): >        x = self.create_another() >        ... do something with X > > Now I create a inherited class of this object: > > class bar(

Re: Late initialization using __getattribute__

2008-09-03 Thread bukzor
On Sep 3, 1:02 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > bukzor a écrit : > (snip) > > > Thanks for the reply. Just to see it not work, I tried to remove > > __getattribute__ from LateInitMixIn, but couldn't get it to work. > > ??? Sorry, I don't get what you mean... Since you said __ge

Re: python/xpath question..

2008-09-03 Thread John Krukoff
On Wed, 2008-09-03 at 13:36 -0700, bruce wrote: > morning > > i apologize up front as this is really more of an xpath question.. > > in my python, i'm using the xpath function to iterate/parse some html. i can > do something like > > s=d.xpath("//tr/td/text()") > count=len(s) > > and get th

Re: email.Message problem

2008-09-03 Thread Corrado Gioannini
On Tue, Sep 02, 2008 at 04:50:15PM -0300, Gabriel Genellina wrote: > > messg = email.message.Message() > > Replace this line with: > messg = email.mime.multipart.MIMEMultipart() > *OR* > Set the Content-Type header to "multipart/mixed" *before* anything else. thanks Gabriel! i coudn't have thou

Re: Python on JavaScript VM's (such as V8)?

2008-09-03 Thread bearophileHUGS
Berco Beute: > I wonder what it would take to implement Python in JavaScript so it > can run on those fancy new JavaScript VM's such as Chrome's V8 or > Firefox' tracemonkey. Much the same as Python implementations in C# > (IronPython) and Java (Jython). It would certainly bring back the fun > in w

Re: Late initialization using __getattribute__

2008-09-03 Thread Bruno Desthuilliers
bukzor a écrit : (snip) Thanks for the reply. Just to see it not work, I tried to remove __getattribute__ from LateInitMixIn, but couldn't get it to work. ??? Sorry, I don't get what you mean... My Base class is a C class (_mysql.connection from MySQLdb) that sometimes segfaults if you try t

Re: Python on the web - newby question

2008-09-03 Thread SimonPalmer
On Sep 3, 8:41 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > SimonPalmer a écrit : > > > Apologies in advance if this is either a) the wrong board or b) been > > answered a million times elsewhere, but... > > > I have been given an assignment to get a python module up and running > > behind

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread bearophileHUGS
Roy Smith: > But, along those lines, I've often thought that split() needed a way to not > just limit the number of splits, but to also throw away the extra stuff. > Getting the first N fields of a string is something I've done often enough > that refactoring the slicing operation right into the sp

Python on JavaScript VM's (such as V8)?

2008-09-03 Thread Berco Beute
I wonder what it would take to implement Python in JavaScript so it can run on those fancy new JavaScript VM's such as Chrome's V8 or Firefox' tracemonkey. Much the same as Python implementations in C# (IronPython) and Java (Jython). It would certainly bring back the fun in web application developm

Re: [wwwsearch-general] python/xpath question..

2008-09-03 Thread John J Lee
On Wed, 3 Sep 2008, bruce wrote: [...] and get the number of total nodes... by subtracting, i can get the number of nodes, without text.. is there an easier way??!! [...] Yes -- don't use XPath :-) John -- http://mail.python.org/mailman/listinfo/python-list

Re: [wwwsearch-general] python - mechanize/browser/POST issue

2008-09-03 Thread John J Lee
On Tue, 2 Sep 2008, bruce wrote: [...] using mechanize/Browser, i can easily do a url/get, and process submitting a form that uses a GET as the action. however, I'm not quite sure how to implement the submittal of a form, that uses the POST action. [...] Same way as any other form. The HTTP me

Re: Late initialization using __getattribute__

2008-09-03 Thread bukzor
On Sep 3, 12:19 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > bukzor a écrit : > > > I want to make a MixIn class that waits to initialize its super- > > classes until an attribute of the object is accessed. Not generally > > useful, but desirable in my case. I've written this, and it works,

Re: [wwwsearch-general] python mechanize/libxml2dom question

2008-09-03 Thread John J Lee
On Mon, 1 Sep 2008, bruce wrote: [...] how can i [...] libxml2dom [...] Just a general point: try lxml.etree instead? Friendlier API. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on the web - newby question

2008-09-03 Thread Bruno Desthuilliers
SimonPalmer a écrit : Apologies in advance if this is either a) the wrong board or b) been answered a million times elsewhere, but... I have been given an assignment to get a python module up and running behind an existing web site. At the moment the rest of the site is developed in PHP but the

Re: Late initialization using __getattribute__

2008-09-03 Thread Bruno Desthuilliers
bukzor a écrit : I want to make a MixIn class that waits to initialize its super- classes until an attribute of the object is accessed. Not generally useful, but desirable in my case. I've written this, and it works, but would like to take any suggestions you guys have. You shouldn't mess with

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread OKB (not okblacke)
Michael Palmer wrote: > As anyone knows, the state of Python GUI programming is a little > fractured at this time, with many toolkits, wrappers and meta-wrappers > dead and alive, with or without documentation. How about Dabo? http://www.dabodev.com/ -- --OKB (not okblacke) Brendan Ba

Python on the web - newby question

2008-09-03 Thread SimonPalmer
Apologies in advance if this is either a) the wrong board or b) been answered a million times elsewhere, but... I have been given an assignment to get a python module up and running behind an existing web site. At the moment the rest of the site is developed in PHP but the hosts have said they wi

Late initialization using __getattribute__

2008-09-03 Thread bukzor
I want to make a MixIn class that waits to initialize its super- classes until an attribute of the object is accessed. Not generally useful, but desirable in my case. I've written this, and it works, but would like to take any suggestions you guys have. I've commented out the "delattr" call because

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Peter Otten <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > > In article <[EMAIL PROTECTED]>, > > Peter Otten <[EMAIL PROTECTED]> wrote: > > > >> > I might take it one step further, however, and do: > >> > > >> >> fields = line.split()[:2] > >> >>

python/xpath question..

2008-09-03 Thread bruce
morning i apologize up front as this is really more of an xpath question.. in my python, i'm using the xpath function to iterate/parse some html. i can do something like s=d.xpath("//tr/td/text()") count=len(s) and get the number of nodes that have text i can then do something like s=d.xpa

Re: Usual practice: running/testing modules in a package

2008-09-03 Thread Casey
On Aug 26, 10:21 pm, Casey <[EMAIL PROTECTED]> wrote: > On Aug 12, 9:57 pm, alito <[EMAIL PROTECTED]> wrote: > > > > > A wrapper on the level up works: > > > ~/python$ cat importercaller.py > > from testpackage import config > > config.hello() > > > ~/python$ python importercaller.py > > hello > >

Re: creating a similar object from an derived class

2008-09-03 Thread Bruno Desthuilliers
Scott a écrit : Let's say I have an object: s/object/class/ class foo(): def create_another() return foo() class Foo(object): def create_another(self): return Foo() def blah(): def blah(self): x = self.create_another() ... do something with X

Re: Coming from .NET and VB and C

2008-09-03 Thread Bruno Desthuilliers
ToPostMustJoinGroup22 a écrit : I'm coming from a .NET, VB, C background. C was good, and VB was better (with all of its libraries). Than .NET came along and all the libraries you can require are ready to go. I have no preference with MySQL or SQL, stored procedures or ad-hoc queries. SO, I'm

Re: creating a similar object from an derived class

2008-09-03 Thread Matimus
On Sep 3, 12:09 pm, Scott <[EMAIL PROTECTED]> wrote: > Let's say I have an object: > > class foo(): >    def create_another() >        return foo() > >    def blah(): >        x = self.create_another() >        ... do something with X > > Now I create a inherited class of this object: > > class bar

Re: Is try-except slow?

2008-09-03 Thread Robert Kern
Steven D'Aprano wrote: On Tue, 02 Sep 2008 18:56:48 -0500, Robert Kern wrote: ssecorp wrote: or why does this take so god damn long time? Several reasons. One of which is that try: except: is slow. I beg to differ. Setting up a try...except block is very fast. Here's an example in Python

Re: properties setting each other

2008-09-03 Thread Bruno Desthuilliers
Maric Michaud a écrit : Le Wednesday 03 September 2008 17:40:43 mk, vous avez écrit : Note that if one property can really be computed from another, this kind of thing could be considered as bad design (except if the computation is heavy). Hmm, why? Is the line of thinking smth like: because th

Re: os.system dual behaviour

2008-09-03 Thread Emile van Sebille
iu2 wrote: Hi guys I do os.system('ls &> e') On one linux machine it emits ls output to the file e as expected. On another linux machine it emits ls to the standard output, and nothing to e! Both machines run Fedora linux. The command "ls &> e" entered at the shell (no python) behaves ok on b

Re: Help needed to freeze a script.

2008-09-03 Thread Michael Palmer
On Sep 3, 1:30 pm, LB <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to freeze a numpy based script in order to have an > application which could run without having to install numpy and cie. > > Indeed, I'm not root on the targeted computer and I can't easily > make a complete install of numpy

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: I disagree with that. Meta-wrappers like this will always suffer from problems, as they have difficulties providing a consistent api. For example wx is said to be very windows-toolkit-centric in it's API. Yes I know that it works under Linux with GTK, but it does not come

Re: max(), sum(), next()

2008-09-03 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: You are right in that sum could be used to sum arbitrary objects. However, in 99.99% of

creating a similar object from an derived class

2008-09-03 Thread Scott
Let's say I have an object: class foo(): def create_another() return foo() def blah(): x = self.create_another() ... do something with X Now I create a inherited class of this object: class bar(foo): ... If I call bar.create_another(), it will return a foo() inst

Re: Looking for File comparison utility that produces actual differences

2008-09-03 Thread Jeff McNeil
On Sep 3, 2:40 pm, [EMAIL PROTECTED] wrote: > Hi, > > I looking for a file comparison utility in Python that works like > 'diff' command in Unix and 'comp' in Windows. > The present 'cmd' in filecmp module only presents output in the form > of 1 or 0 i.e whether the 2 files differ or not? > > So,

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Michael Palmer
On Sep 3, 12:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Michael Palmer schrieb: > > > The other, PyGUI, has an even nicer API and more docs but has > > relatively few widgets implemented at this time. It also strives for > > compatibility with several toolkits (two at this time), which

Re: Looking for File comparison utility that produces actual differences

2008-09-03 Thread Wojtek Walczak
On Wed, 3 Sep 2008 19:40:40 +0100, [EMAIL PROTECTED] wrote: > I looking for a file comparison utility in Python that works like > 'diff' command in Unix and 'comp' in Windows. > The present 'cmd' in filecmp module only presents output in the form > of 1 or 0 i.e whether the 2 files differ or not?

Looking for File comparison utility that produces actual differences

2008-09-03 Thread dudeja . rajat
Hi, I looking for a file comparison utility in Python that works like 'diff' command in Unix and 'comp' in Windows. The present 'cmd' in filecmp module only presents output in the form of 1 or 0 i.e whether the 2 files differ or not? So, I'm lookin for something that generates actual differences

Re: Is try-except slow?

2008-09-03 Thread Fredrik Lundh
process wrote: is this faster btw? I guess big doesn't help, it's only retrieved once anyway? But is rows retrieved in every loop? the python interpreter aint too smart? > def getPixels(fileName): im = PIL.Image.open(fileName) colors = [] r, c = im.size big = range(0, c) ro

RE: Help on try-except

2008-09-03 Thread Matthew Burns
The reason it takes so long is you are not using xrange The range function iterates through the entire data set EVERY time, regardless of whether it needs to This increases processer use EXPONENTIALLY as that number gets larger. I am not quite sure how xrange works, but it keeps only one number in

RE: Using strftime

2008-09-03 Thread Ahmed, Shakir
You can try Import time mytimeymd = time.strftime('%y%m%d') print mytimeymd -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of frankrentef Sent: Wednesday, September 03, 2008 1:21 PM To: python-list@python.org Subject: Using strftime I have one line of c

Help needed to freeze a script.

2008-09-03 Thread LB
Hi, I would like to freeze a numpy based script in order to have an application which could run without having to install numpy and cie. Indeed, I'm not root on the targeted computer and I can't easily make a complete install of numpy and scipy. So I decided to test the freeze.py tool shipped

Using strftime

2008-09-03 Thread frankrentef
I have one line of code that put's an old date in my code. ie.textBoxSet('_ct10_PlaceHolder_txtEnd', '8/15/2008') What I wish to do in another similiar line is have the field populated with the current system date? How best to do this? I've read some of the strftime documentation but as of y

Writing Unicode to database using ODBC

2008-09-03 Thread Mudcat
In short what I'm trying to do is read a document using an xml parser and then upload that data back into a database. I've got the code more or less completed using xml.etree.ElementTree for the parser and dbi/ odbc for my db connection. To fix problems with unicode I built a work-around by mappin

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Marc 'BlackJack' Rintsch
On Wed, 03 Sep 2008 03:09:18 -0400, Derek Martin wrote: > On Wed, Sep 03, 2008 at 06:40:10AM +, Marc 'BlackJack' Rintsch > wrote: >> On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: >> >> >> And if they model an action there must be some way to activate the >> >> action >> > >> > That

Re: Coming from .NET and VB and C

2008-09-03 Thread Eric Wertman
> Using Python. I found "Dive Into Python" which I will be reading shortly The title of the book is good advice all by itself. Especially with prior programming experience, you'll get started very quickly. What will take longer is the assimilation of some of python's neater and more idiomatic

Re: Coming from .NET and VB and C

2008-09-03 Thread Simon Brunning
2008/9/3 ToPostMustJoinGroup22 <[EMAIL PROTECTED]>: > Any suggestions for someone new to the scene like me? Welcome! There's a number of resources that you might find useful here: http://wiki.python.org/moin/BeginnersGuide -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-li

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic APIs:

Coming from .NET and VB and C

2008-09-03 Thread ToPostMustJoinGroup22
I'm coming from a .NET, VB, C background. C was good, and VB was better (with all of its libraries). Than .NET came along and all the libraries you can require are ready to go. I have no preference with MySQL or SQL, stored procedures or ad-hoc queries. SO, I'm interested in using my Google App

PyGUI as a standard GUI API for Python?

2008-09-03 Thread Michael Palmer
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic APIs: PyGUI and wax. The latte

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 17:40:43 mk, vous avez écrit : > > Note that if one property can really be computed from another, this kind > > of thing could be considered as bad design (except if the computation is > > heavy). > > Hmm, why? Is the line of thinking smth like: because the variables

Re: Numeric literal syntax

2008-09-03 Thread Cliff
On Sep 2, 12:34 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > I would argue that the precedent, already within Python, for using a > > space to separate pieces of a string literal, is more important than > > precedents from other programming languages. > > that precedent also

Re: properties setting each other

2008-09-03 Thread mk
Thanks to everyone for answers.. *but*, if you want to add more logic in the setters, you could want to add two extra methods : def _setsquare(self, v) : # some extra logic here self._square = s def fsetsquare(self,s): self

Re: Numeric literal syntax

2008-09-03 Thread bearophileHUGS
Ben Finney: > … for numbers with many digits the digits may be divided into > groups of three by a thin space, in order to facilitate reading. > Neither dots nor commas are inserted in the spaces between groups > of three. > http://www.bipm.org/en/si/si_brochure/chapter5/5-3-2.h

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Diez B. Roggisch
Xavier schrieb: Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly losts

os.system dual behaviour

2008-09-03 Thread iu2
Hi guys I do os.system('ls &> e') On one linux machine it emits ls output to the file e as expected. On another linux machine it emits ls to the standard output, and nothing to e! Both machines run Fedora linux. The command "ls &> e" entered at the shell (no python) behaves ok on both machines.

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Xavier
I tried under Linux... same problem. So... it may comes from my little lines of code... or from my GPS. -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney <[EMAIL PROTECTED]> wrote: > Another reason in support of spaces (rather than underscores) to > separate digit groups: it's the only separator that follows the SI > standard for representing numbers: > > ??? for numbers with many digits the digits may be divided into

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 16:44:10 Maric Michaud, vous avez écrit : >          def _setsquare(self, v) : >                  # some extra logic here >                  self._square = s > >          def fsetsquare(self,s): >                  self._setsquare(s) >                  self._setvalue =

Re: properties setting each other

2008-09-03 Thread Bruno Desthuilliers
mk a écrit : Hello everyone, I try to set two properties, "value" and "square" in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: > >>> import math >>> class Squared2(object)

Re: properties setting each other

2008-09-03 Thread Diez B. Roggisch
mk schrieb: Hello everyone, I try to set two properties, "value" and "square" in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: >>> import math >>> class Squared2(object):

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 15:57:50 mk, vous avez écrit : > I try to set two properties, "value" and "square" in the following code, > and arrange it in such way that setting one property also sets another > one and vice versa. But the code seems to get Python into infinite loop: > >  >>> impor

Re: properties setting each other

2008-09-03 Thread Wojtek Walczak
On Wed, 3 Sep 2008 14:31:17 + (UTC), Wojtek Walczak wrote: > class Square(object): >def __init__(self, val): > self._square = pow(val, 2) > self._value = math.sqrt(self.square) ^^ or just: self._value = val :-) -- Regards, W

Re: properties setting each other

2008-09-03 Thread Wojtek Walczak
On Wed, 03 Sep 2008 15:57:50 +0200, mk wrote: > I try to set two properties, "value" and "square" in the following code, > and arrange it in such way that setting one property also sets another > one and vice versa. But the code seems to get Python into infinite loop: > Is there a way to achiev

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Peter Otten
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Peter Otten <[EMAIL PROTECTED]> wrote: > >> > I might take it one step further, however, and do: >> > >> >> fields = line.split()[:2] >> >> a, b = map(int, fields) >> > >> > in fact, I might even get rid of the very generic,

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> writes: > >> I don't see any good reason (other than your familiarity with the D >> language) to use underscores for this purpose, and much more reason >> (readability, consistency, fewer arbitrary differences in

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-02, Christian Heimes <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: >> Peter Pearson wrote: >> >>> (startled noises) It is a delight to find a reference to >>> that half-century-old essay (High Finance) by the wonderful >>> C. Northcote Parkinson, but how many readers will catch the

  1   2   >