Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Gregory Ewing
Steven D'Aprano wrote: super() is just as explicit as len(), or str.upper(). It says, explicitly, that it will call the method belonging to one or more superclass of the given class. That's not strictly true. It will call a method belonging to some class in the mro of self, but that class is

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Gregory Ewing
Steven D'Aprano wrote: On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: > "mro" would have been the proper name for "super". That's your opinion. In any case, whether super() was called super() or mro() or aardvark() makes no difference to the functionality or whether it is

Re: Newbie question regarding SSL and certificate verification

2010-07-30 Thread Gregory Ewing
David Robinow wrote: Never use security software version 1.0 or greater. It was written by an author insufficiently paranoid. Hmmm. So to get people to trust your security software, you should start with version 0.0 and increment by 0.001 for each release. :-) -- Greg -- http://mail.python

how to build same executabl with and without console output

2010-07-30 Thread Gelonida
Hi, What I'd like to achieve ideally is to create a py2exe program, which will only display a window (so 'compiled' as 'windows'-application) if called normally. however if being called with the option --debug it should display the graphical window plus a debug console where I can print to. I

Re: default behavior

2010-07-30 Thread Peter Otten
wheres pythonmonks wrote: > How do I build an "int1" type that has a default value of 1? > [Hopefully no speed penalty.] > I am thinking about applications with collections.defaultdict. >>> from collections import defaultdict >>> d = defaultdict(1 .conjugate) >>> d["x"] += 2 >>> d["x"] 3 Isn't t

Re: stdout of external program.

2010-07-30 Thread Jean-Michel Pichavant
Paul Lemelle wrote: HELP! :) I am trying to output the following program's output to either a file or variable, how can this be done? # Writing the output to a standard argv argument #1/usr/bin/python import sys for arg in sys.argv: print arg #END Thanks, Paul Hi Paul, after reading

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Jimmy Retzlaff
On Fri, Jul 30, 2010 at 1:10 AM, Gelonida wrote: > What I'd like to achieve ideally is to create a py2exe program, > which > will only display a window (so 'compiled' as 'windows'-application) if > called normally. > > however if being called with the option --debug it should display the > graphic

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: [snip] As someone already said in this list, the main problem with super is that it tends to refer to the superclass method while in fact it calls the next MRO method. Why do you think that is a pr

Re: default behavior

2010-07-30 Thread Duncan Booth
Peter Otten <__pete...@web.de> wrote: from collections import defaultdict d = defaultdict(1 .conjugate) d["x"] += 2 d["x"] > 3 > > Isn't that beautiful? Almost like home;) > > It is also fast: > > $ python -m timeit -s"one = lambda: 1" "one()" > 100 loops, best of 3: 0.2

Re: default behavior

2010-07-30 Thread Peter Otten
Duncan Booth wrote: > Peter Otten <__pete...@web.de> wrote: > > from collections import defaultdict > d = defaultdict(1 .conjugate) > d["x"] += 2 > d["x"] >> 3 >> >> Isn't that beautiful? Almost like home;) >> >> It is also fast: >> >> $ python -m timeit -s"one = lambda: 1" "on

Re: default behavior

2010-07-30 Thread Duncan Booth
Peter Otten <__pete...@web.de> wrote: > real is a property, not a method. conjugate() was the first one that > worked that was not __special__. I think it has the added benefit that > it's likely to confuse the reader... > Ah, silly me, I should have realised that. Yes, micro-optimisations that a

Re: python styles: why Use spaces around arithmetic operators?

2010-07-30 Thread Lawrence D'Oliveiro
In message , J.B. Brown wrote: > I personally prefer to be slightly excessive in the amount of spacing > I used, especially when parentheses are involved. > > myTuple = ( 1, 2, 3, 4, 5 ) Parentheses are punctuation. Why not leave spaces around the commas as well, to be consistent? myTuple

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread python
> Is there any trick in adding a console window to an application, that was > built as 'windows' application? I was recently wondering the same thing myself. My research indicates that its not possible to have a single Windows application that can run in both console and GUI ("Windows") modes. H

Normalizing A Vector

2010-07-30 Thread Lawrence D'Oliveiro
Say a vector V is a tuple of 3 numbers, not all zero. You want to normalize it (scale all components by the same factor) so its magnitude is 1. The usual way is something like this: L = math.sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]) V = (V[0] / L, V[1] / L, V[2] / L) What I don’t li

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Steven D'Aprano
On Fri, 30 Jul 2010 19:35:52 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> super() is just as explicit as len(), or str.upper(). It says, >> explicitly, that it will call the method belonging to one or more >> superclass of the given class. > > That's not strictly true. It will call

Re: default behavior

2010-07-30 Thread wheres pythonmonks
Instead of defaultdict for hash of lists, I have seen something like: m={}; m.setdefault('key', []).append(1) Would this be preferred in some circumstances? Also, is there a way to upcast a defaultdict into a dict? I have also heard some people use exceptions on dictionaries to catch key existe

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Steven D'Aprano
On Fri, 30 Jul 2010 19:37:29 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: >> On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: > > >>>"mro" would have been the proper name for "super". >> >> That's your opinion. In any case, whether super() was called super() or >> mro() o

Re: default behavior

2010-07-30 Thread Steven D'Aprano
On Fri, 30 Jul 2010 07:59:52 -0400, wheres pythonmonks wrote: > Instead of defaultdict for hash of lists, I have seen something like: > > > m={}; m.setdefault('key', []).append(1) > > Would this be preferred in some circumstances? Sure, why not? Whichever you prefer. setdefault() is a venera

Re: default behavior

2010-07-30 Thread Peter Otten
wheres pythonmonks wrote: > Instead of defaultdict for hash of lists, I have seen something like: > > > m={}; m.setdefault('key', []).append(1) > > Would this be preferred in some circumstances? In some circumstances, sure. I just can't think of them at the moment. Maybe if your code has to w

Re: default behavior

2010-07-30 Thread wheres pythonmonks
Sorry, doesn't the following make a copy? from collections import defaultdict as dd x = dd(int) x[1] = 'a' x > defaultdict(, {1: 'a'}) dict(x) > {1: 'a'} > > I was hoping not to do that -- e.g., actually reuse the same underlying data. Maybe dict(x), where x is a defaul

The untimely dimise of a weak-reference

2010-07-30 Thread Vincent van Beveren
Hi everyone, I was working with weak references in Python, and noticed that it was impossible to create a weak-reference of bound methods. Here is a little python 3.0 program to prove my point: import weakref print("Creating object...") class A(object): def b(self): print("I a

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Fri, 30 Jul 2010 19:37:29 +1200, Gregory Ewing wrote: Steven D'Aprano wrote: On Thu, 29 Jul 2010 19:29:24 +0200, Jean-Michel Pichavant wrote: > "mro" would have been the proper name for "super". That's your opinion. In any case, whethe

Basic Information about Python

2010-07-30 Thread Durga D
Hi All, I am new to python based application developement. I am using Windows XP. 1. Can I create desktop application (just hello world program) with Python language like exe in VC++? 2. If First statement is Yes, Can I include this application with my existing setup(assume 10 MB) for wind

RE: Ascii to Unicode.

2010-07-30 Thread Lawrence D'Oliveiro
In message , Joe Goldthwaite wrote: > Ascii.csv isn't really a latin-1 encoded file. It's an ascii file with a > few characters above the 128 range that are causing Postgresql Unicode > errors. Those characters work fine in the Windows world but they're not > the correct byte representation for

Re: Ascii to Unicode.

2010-07-30 Thread Lawrence D'Oliveiro
In message <4c51d3b6$0$1638$742ec...@news.sonic.net>, John Nagle wrote: > UTF-8 is a stream format for Unicode. It's slightly compressed ... “Variable-length” is not the same as “compressed”. Particularly if you’re mainly using non-Roman scripts... -- http://mail.python.org/mailman/listin

RE: Ascii to Unicode.

2010-07-30 Thread Lawrence D'Oliveiro
In message , Joe Goldthwaite wrote: > Next I tried to write the unicodestring object to a file thusly; > > output.write(unicodestring) > > I would have expected the write function to request the byte string from > the unicodestring object and simply write that byte string to a file. Encoded ac

Re: solving Tix problem in ubuntu jaunty

2010-07-30 Thread Lawrence D'Oliveiro
In message <7cbe39d0-cac8-41d8-b80a-a148ac4b7...@q21g2000prm.googlegroups.com>, jimgardener wrote: > How do I correct the problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic Information about Python

2010-07-30 Thread Jean-Michel Pichavant
Durga D wrote: Hi All, I am new to python based application developement. I am using Windows XP. 1. Can I create desktop application (just hello world program) with Python language like exe in VC++? yes http://www.py2exe.org/ 2. If First statement is Yes, Can I include this applicati

Re: urllib timeout

2010-07-30 Thread Lawrence D'Oliveiro
In message <43f464f9-3f8a-4bec-8d06-930092d5a...@g6g2000pro.googlegroups.com>, kBob wrote: > The company changed the Internet LAN connections to "Accept Automatic > settings" and "Use automatic configuration script" Look at that configuration script, figure out what it’s returning for a proxy

Re: The untimely dimise of a weak-reference

2010-07-30 Thread Peter Otten
Vincent van Beveren wrote: > Hi everyone, > > I was working with weak references in Python, and noticed that it was > impossible to create a weak-reference of bound methods. Here is a little > python 3.0 program to prove my point: > > import weakref > > print("Creating object...") > class A(obj

Re: measuring a function time

2010-07-30 Thread Hrvoje Niksic
Steven D'Aprano writes: > On Thu, 29 Jul 2010 14:42:58 +0200, Matteo Landi wrote: > >> This should be enough >> >import time >tic = time.time() >function() >toc = time.time() >print toc - tic > > You're typing that in the interactive interpreter, which means the > timer is co

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Hrvoje Niksic
Gregory Ewing writes: > I think the point is that the name is misleading, because it makes it > *sound* like it's going to call a method in a superclass, when it fact > it might not. That is indeed confusing to some people, especially those who refuse to to accept the notion that "superclass" me

Re: combined functionality of ipython's %whos and pdb's next (without a resource heavy IDE)

2010-07-30 Thread Ed Leafe
On Jul 29, 2010, at 3:39 PM, Benjamin J. Racine wrote: > I am trying to combine the ability to move line-by-line through the code as > is done with pdb's "next" function with ipython's ability to list all > variables at once... without the use of a full-fledged IDE. > > I am not seeing how this

pylint scores

2010-07-30 Thread wheres pythonmonks
I am starting to use pylint to look at my code and I see that it gives a rating. What values do experienced python programmers get on code not targeting the benchmark? I wrote some code, tried to keep it under 80 characters per line, reasonable variable names, and I got: 0.12 / 10. Is this a goo

Problem with Elementtree and XMLSchem instance type

2010-07-30 Thread Roland Hedberg
Hi! I have the following XML snippet: http://www.w3.org/2001/XMLSchema-instance"; xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"; xsi:type="fed:SecurityTokenServiceType"> This part after parsing with Elementtree gives me an Element instance with the following pr

Re: pylint scores

2010-07-30 Thread Peter Otten
wheres pythonmonks wrote: > I am starting to use pylint to look at my code and I see that it gives a > rating. What values do experienced python programmers get on code not > targeting the benchmark? > > I wrote some code, tried to keep it under 80 characters per line, > reasonable variable names

Re: Normalizing A Vector

2010-07-30 Thread Alain Ketterlin
Lawrence D'Oliveiro writes: > Say a vector V is a tuple of 3 numbers, not all zero. You want to normalize > it (scale all components by the same factor) so its magnitude is 1. > > The usual way is something like this: > > L = math.sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]) > V = (V[0]

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Dave Angel
pyt...@bdurham.com wrote: Is there any trick in adding a console window to an application, that was built as 'windows' application? I was recently wondering the same thing myself. My research indicates that its not possible to have a single Windows application that can run in both console

Re: Basic Information about Python

2010-07-30 Thread Durga D
Hi JM, Thanks alot for your prompt response. If I include into windows setup, what will be setup size (assume before include 10 MB)? i mean, python supporting dlls/libs size for python exe. Regards, Durga. On Jul 30, 6:04 pm, Jean-Michel Pichavant wrote: > Durga D wrote: > > Hi All, >

RE: The untimely dimise of a weak-reference

2010-07-30 Thread Vincent van Beveren
Hi Peter, I did not know the object did not keep track of its bound methods. What advantage is there in creating a new bound method object each time its referenced? It seems kind of expensive. Regards, Vincent -Original Message- From: Peter Otten [mailto:__pete...@web.de] Sent: vrijda

RE: The untimely dimise of a weak-reference

2010-07-30 Thread Peter Otten
Vincent van Beveren wrote: > I did not know the object did not keep track of its bound methods. What > advantage is there in creating a new bound method object each time its > referenced? It seems kind of expensive. While I didn't measure it I suppose that it saves a lot of memory. Peter -- htt

Re: measuring a function time

2010-07-30 Thread Albert Hopkins
On Fri, 2010-07-30 at 14:28 +0200, Hrvoje Niksic wrote: > Steven D'Aprano writes: > > > On Thu, 29 Jul 2010 14:42:58 +0200, Matteo Landi wrote: > > > >> This should be enough > >> > >import time > >tic = time.time() > >function() > >toc = time.time() > >print toc - tic > > >

Re: Basic Information about Python

2010-07-30 Thread Eli Bendersky
On Fri, Jul 30, 2010 at 16:55, Durga D wrote: > Hi JM, > > Thanks alot for your prompt response. > > If I include into windows setup, what will be setup size (assume > before include 10 MB)? i mean, python supporting dlls/libs size for > python exe. > IIRC, the size of a simple "hello world"

Re: The untimely dimise of a weak-reference

2010-07-30 Thread Christian Heimes
Am 30.07.2010 16:06, schrieb Vincent van Beveren: > I did not know the object did not keep track of its bound methods. What > advantage is there in creating a new bound method object each time its > referenced? It seems kind of expensive. Instances of a class have no means of storing the bound m

Re: measuring a function time

2010-07-30 Thread MRAB
Albert Hopkins wrote: On Fri, 2010-07-30 at 14:28 +0200, Hrvoje Niksic wrote: Steven D'Aprano writes: On Thu, 29 Jul 2010 14:42:58 +0200, Matteo Landi wrote: This should be enough import time tic = time.time() function() toc = time.time() print toc - tic You're typing that in the interac

RE: Access stdout from external program.

2010-07-30 Thread Paul Lemelle
JM, Thanks for the response.  I am trying to capture the stdout of a program from another program. Example, I want to launch the below program from a second python script then capture the first's program stdout to a file or variable. Is this possible? Thanks again, Paul Paul Lemelle wro

Re: Access stdout from external program.

2010-07-30 Thread Jean-Michel Pichavant
Paul Lemelle wrote: JM, Thanks for the response. I am trying to capture the stdout of a program from another program. Example, I want to launch the below program from a second python script then capture the first's program stdout to a file or variable. Is this possible? Thanks again, Paul

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Raymond Hettinger
On Jul 25, 5:30 pm, Gregory Ewing wrote: > Raymond Hettinger wrote: > > Every class > > in the MRO implementing the target method *must* call super() to give > > the next class in the MRO a chance to run. > > EXCEPT for the last one, which must NOT call super! > > The posted example happens to wor

Re: Basic Information about Python

2010-07-30 Thread kevinlcarlson
On Jul 30, 6:55 am, Durga D wrote: > Hi JM, > >    Thanks alot for your prompt response. > >    If I include into windows setup, what will be setup size (assume > before include 10 MB)? i mean, python supporting dlls/libs size for > python exe. > > Regards, > Durga. > > On Jul 30, 6:04 pm, Jean-Mi

Re: Two minor questions on Class

2010-07-30 Thread Peter Otten
joy99 wrote: > class Person(object): > def _init_(self,name,age): > self.name=name > self.age=age > > as i wrote the code using IDLE on WinXP SP2, with Python2.6.5, I am > getting the following error: > > >>> p=Person('Subha',40) > > Traceback (most recen

how python works

2010-07-30 Thread Mahmood Naderan
I want to know how python executes a .py file. Sometimes when I run a file, I get an error that there is a syntax error. This shows that the parser read and parse the whole file. Sometimes in the middle of the run I get an error that another line has problem. So how does it work? if it doesn't c

Re: Two minor questions on Class

2010-07-30 Thread Shashank Singh
On Fri, Jul 30, 2010 at 10:53 PM, joy99 wrote: > class Person(object): >def _init_(self,name,age): >self.name=name >self.age=age > > constructor has double underscores (both as prefix and suffix) __init__ -- Regards Shashank Singh Senior Undergraduate, De

Two minor questions on Class

2010-07-30 Thread joy99
Dear Group, Hope everyone is fine. I was trying some examples of Python class. I took the following example from Ubuntu forum[http://ubuntuforums.org/ showthread.php?t=578930] class Person(object): def _init_(self,name,age): self.name=name self.age=age as

Use cases for "setattr" in existing code

2010-07-30 Thread John Nagle
I've been looking at existing code, using Google Code search, to see what use cases for "setattr" are actually used in production code. High-performance implementations like Shed Skin try to avoid dynamic creation of attributes, so it's worth seeing where this feature is used in production.

Re: how python works

2010-07-30 Thread Burton Samograd
Mahmood Naderan writes: > I want to know how python executes a .py file. Sometimes when I run a > file, I get an error that there is a syntax error. This shows that the > parser read and parse the whole file. Sometimes in the middle of the > run I get an error that another line has problem. So ho

Re: how python works

2010-07-30 Thread Mahmood Naderan
So is it a compiler or interpreter?   // Naderan *Mahmood; From: Burton Samograd To: python-list@python.org Sent: Fri, July 30, 2010 10:36:56 PM Subject: Re: how python works Mahmood Naderan writes: > I want to know how python executes a .py file. Sometimes

Re: Library versions

2010-07-30 Thread Chris Withers
Peo wrote: Is there some other smart way to do acheive this? Just turn them info python packages, and use buildout, pip or some other python package management tool to create the versions. You may, of course, just be able to svn the lot of them... (then you don't need to worry about numberin

Re: how python works

2010-07-30 Thread Burton Samograd
Mahmood Naderan writes: > So is it a compiler or interpreter? There's a compiler that compiles python to bytecode which is then interpreted. This saves the interpreter from having to re-parse the code at run time. So, it's an interpreter that compiles the code first. -- Burton Samograd --

Re: Normalizing A Vector

2010-07-30 Thread Chris Rebert
On Fri, Jul 30, 2010 at 4:46 AM, Lawrence D'Oliveiro wrote: > Say a vector V is a tuple of 3 numbers, not all zero. You want to normalize > it (scale all components by the same factor) so its magnitude is 1. > > The usual way is something like this: > >    L = math.sqrt(V[0] * V[0] + V[1] * V[1] +

Re: how python works

2010-07-30 Thread Stephen Hansen
On 7/30/10 11:16 AM, Mahmood Naderan wrote: > So is it a compiler or interpreter? Neither/both, depending on your definition of either word. It does not compile to machine code: it compiles to byte code (which it then usually, but not always, stores in a pyc file alongside the py file). It does no

Re: how python works

2010-07-30 Thread Mahmood Naderan
>Neither/both, depending on your definition of either word. It does not >compile to machine code: it compiles to byte code (which it then >usually, but not always, stores in a pyc file alongside the py file). It >does not interpret the Python code on the fly, it is a VM which >"interprets" the byte

ImportError: No module named binascii

2010-07-30 Thread Dieter
Hi there, I installed python 2.7 from the tar ball on python.org. the installation was pretty uneventful. However, I need to run someone elses python code and get the error message ImportError: No module named binascii Any recommendations how to correct this? Is there another tar file somewhere

Re: pylint scores

2010-07-30 Thread News123
On 07/30/2010 03:12 PM, wheres pythonmonks wrote: > I am starting to use pylint to look at my code and I see that it gives a > rating. > What values do experienced python programmers get on code not > targeting the benchmark? > > I wrote some code, tried to keep it under 80 characters per line, >

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Gelonida
Hi, On 07/30/2010 03:51 PM, Dave Angel wrote: > pyt...@bdurham.com wrote: >>> Is there any trick in adding a console window to an application, that >>> was built as 'windows' application? ,,, >>> Since we're talking MS Windows here, see: > > http://msdn.microsoft.com/en-us/library/ms682528(VS.85)

Re: py2app with weave fails

2010-07-30 Thread Aahz
In article <4f6430e5-31ea-450d-a2b9-56442a714...@k19g2000yqc.googlegroups.com>, Soren wrote: > >I'm trying to create a standalone app using py2app, but it seems no >matter what I do I get this error: Try pythonmac-...@python.org -- Aahz (a...@pythoncraft.com) <*> http://www.py

Re: [Py2exe-users] how to build same executabl with and without console output

2010-07-30 Thread Gelonida
On 07/30/2010 11:00 AM, Jimmy Retzlaff wrote: > On Fri, Jul 30, 2010 at 1:10 AM, Gelonida wrote: >> What I'd like to achieve ideally is to create a py2exe program, >> which >> will only display a window (so 'compiled' as 'windows'-application) if >> called normally. >> ... >> >> Is there any way t

trace of Thermite (tm) at WTC, almost no asbestos: if the main beams had been clad, they mightn't have weakened enough to collapse!

2010-07-30 Thread spudnik
here are some speeches about the British World Wars, collected in one book on http://tarpley.net: How the Venetian System Was Transplanted Into England New Federalist, June 3, 1996 The British Empire Bid for Undisputed World Domination, 1850-1870 Schiller Institute Food For Peace Conference, Ch

Re: ImportError: No module named binascii

2010-07-30 Thread MRAB
Dieter wrote: Hi there, I installed python 2.7 from the tar ball on python.org. the installation was pretty uneventful. However, I need to run someone elses python code and get the error message ImportError: No module named binascii Any recommendations how to correct this? Is there another tar

Re: ImportError: No module named binascii

2010-07-30 Thread Dave Angel
Dieter wrote: Hi there, I installed python 2.7 from the tar ball on python.org. the installation was pretty uneventful. However, I need to run someone elses python code and get the error message ImportError: No module named binascii Any recommendations how to correct this? Is there another tar

os.fork on linux defunct

2010-07-30 Thread Ray
I'm running python 2.4 on linux. I use python os.fork run tcpdump, but after I kill the forked process (tcpdump) in linux it shows defunct here is the code: #!/usr/bin/python import time, os class Test: def fork(self): self.pid=os.fork() if self.pid=0: args=['tcpdu

Re: os.fork on linux defunct

2010-07-30 Thread Ray
On Jul 30, 6:03 pm, Ray wrote: > I'm running python 2.4 on linux. I use python os.fork run tcpdump, but > after I kill the forked process (tcpdump) in linux it shows defunct > > here is the code: > > #!/usr/bin/python > import time, os > class Test: >     def fork(self): >         self.pid=os.fork

Tkinter Label alignment problem using OS 10.6

2010-07-30 Thread AJ
Dear users, I have written a sample program that ran correctly with earlier than Mac OS 10.6. The answer field Label does not align correctly. I downloaded the latest Python 2.7 release but still did not solve the problem. Look for line "L4.place(relx=0.32,rely=0.56, anchor=W)" #!/usr/bin/env py

Re: Tkinter Label alignment problem using OS 10.6

2010-07-30 Thread rantingrick
On Jul 30, 6:52 pm, AJ wrote: > Dear users, > > I have written a sample program that ran correctly with earlier than > Mac OS 10.6. The answer field Label does not align correctly. I > downloaded the latest Python 2.7 release but still did not solve the > problem.  Look for line "L4.place(relx=0.3

Re: os.fork on linux defunct

2010-07-30 Thread Cameron Simpson
On 30Jul2010 15:09, Ray wrote: | On Jul 30, 6:03 pm, Ray wrote: | > I'm running python 2.4 on linux. I use python os.fork run tcpdump, but | > after I kill the forked process (tcpdump) in linux it shows defunct [...] | > after I call kill() it will kill tcpdump (capture will stop) but on | > linu

Re: pylint scores

2010-07-30 Thread Dan Stromberg
On Fri, Jul 30, 2010 at 12:18 PM, News123 wrote: > On 07/30/2010 03:12 PM, wheres pythonmonks wrote: > > I am starting to use pylint to look at my code and I see that it gives a > rating. > > What values do experienced python programmers get on code not > > targeting the benchmark? > > > > I wrot

Re: os.fork on linux defunct

2010-07-30 Thread Lawrence D'Oliveiro
In message <77a879cc-94ab-4e2a-a4af-a6945a5b8...@q16g2000prf.googlegroups.com>, Ray wrote: > I think I found it. need to call os.wait() The rule on Unix/Linux systems is: “always remember to gobble your zombie children”. -- http://mail.python.org/mailman/listinfo/python-list

Anushka for Shape FX Hot Shot Thigh Gel

2010-07-30 Thread ANUSHKA
Anushka for Shape FX Hot Shot Thigh Gel ** http://sites.google.com/site/anushkaphotosalert -- http://mail.python.org/mailman/listinfo/python-list

Re: python styles: why Use spaces around arithmetic operators?

2010-07-30 Thread Cousin Stanley
> Parentheses are punctuation. Why not leave spaces around the commas as well, > to be consistent? > > myTuple = ( 1 , 2 , 3 , 4 , 5 ) Personally, I do use this particular style with commas as I find it more readable to my old and tired eyes Mandate m o r e whitespace :-)

Re: Multiprocessing taking too much time

2010-07-30 Thread Dan Stromberg
On Thu, Jul 29, 2010 at 12:04 PM, John Nagle wrote: > On 7/29/2010 11:08 AM, Shailendra wrote: > >> Hi All, >> I have a following situation. >> ==PSUDO CODE START== >> class holds_big_array: >> big_array #has a big array >> >> def get_some_element(self, co

Re: Ascii to Unicode.

2010-07-30 Thread John Machin
On Jul 30, 4:18 am, Carey Tilden wrote: > In this case, you've been able to determine the > correct encoding (latin-1) for those errant bytes, so the file itself > is thus known to be in that encoding. The most probably "correct" encoding is, as already stated, and agreed by the OP to be, cp1252.

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Gregory Ewing
Steven D'Aprano wrote: A / \ C B \ / D / \ E F Yes, a super call might jog left from C to B, but only when being called from one of the lower classes D-F. That's still an upwards call relative to the originator, not sidewards. But it's not an upward ca

Re: The untimely dimise of a weak-reference

2010-07-30 Thread Gregory Ewing
Vincent van Beveren wrote: I was working with weak references in Python, and noticed that it > was impossible to create a weak-reference of bound methods. > is there anything I can do about it? You can create your own wrapper that keeps a weak reference to the underlying object. Here's an exa

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Steven D'Aprano
On Sat, 31 Jul 2010 14:25:39 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> A >> / \ >> C B >> \ / >> D >> / \ >> E F >> >> Yes, a super call might jog left from C to B, but only when being >> called from one of the lower classes D-F. That's stil

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Steven D'Aprano
On Fri, 30 Jul 2010 14:43:07 +0200, Jean-Michel Pichavant wrote: > Quoting Michele's article (I think he's still hanging around this list) > > "Readers familiar will single inheritance languages, such as Java or > Smalltalk, will have a clear concept of superclass in mind. This > concept, however

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-30 Thread Ian Kelly
On Fri, Jul 30, 2010 at 6:38 AM, Hrvoje Niksic wrote: > Gregory Ewing writes: > >> I think the point is that the name is misleading, because it makes it >> *sound* like it's going to call a method in a superclass, when it fact >> it might not. > > That is indeed confusing to some people, especial

Re: Tkinter Label alignment problem using OS 10.6

2010-07-30 Thread AJ
On Jul 30, 5:07 pm, rantingrick wrote: > On Jul 30, 6:52 pm, AJ wrote: > > > Dear users, > > > I have written a sample program that ran correctly with earlier than > > Mac OS 10.6. The answer field Label does not align correctly. I > > downloaded the latest Python 2.7 release but still did not so

Re: default behavior

2010-07-30 Thread Steven D'Aprano
On Fri, 30 Jul 2010 08:34:52 -0400, wheres pythonmonks wrote: > Sorry, doesn't the following make a copy? > > from collections import defaultdict as dd x = dd(int) > x[1] = 'a' > x >> defaultdict(, {1: 'a'}) > dict(x) >> {1: 'a'} >> >> >> > > I was hoping not to do that -- e.g.,

Re: Performance ordered dictionary vs normal dictionary

2010-07-30 Thread Dan Stromberg
On Wed, Jul 28, 2010 at 11:11 PM, Chris Rebert wrote: > On Wed, Jul 28, 2010 at 8:12 PM, Navkirat Singh > wrote: > > Sorry, I might have been a bit vague: > > (Also, I am new to pythong) > > I am trying to do construct my own web session tracking algorithm for a > web > > server (which also I ha

Re: default behavior

2010-07-30 Thread wheres pythonmonks
> > Hint -- what does [].append(1) return? > Again, apologies from a Python beginner. It sure seems like one has to do gymnastics to get good behavior out of the core-python: Here's my proposed fix: m['key'] = (lambda x: x.append(1) or x)(m.get('key',[])) Yuck! So I guess I'll use defaultdic

have you read emacs manual cover to cover?; (was Do we need a "Stevens" book?)

2010-07-30 Thread Xah Lee
cleaned up and extended my previous post. Sentences and ideas made more precise and detailed. • Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover? http://xahlee.org/emacs/emacs_manual_cover_to_cover.html plain text version follows: ---