Re: Use the Source Luke

2011-02-04 Thread Stefan Behnel
OKB (not okblacke), 04.02.2011 20:11: I think Python has its own warts comparable to some of those you mention, but not all. What bothers me most is when "practicality beats purity" is invoked, with practicality defined as "doing it this way is faster in C". Most of that should be gone in Pyth

Re: Use the Source Luke

2011-02-04 Thread rusi
On Feb 5, 12:11 am, "OKB (not okblacke)" wrote: > >         Very interesting, thanks.  I think Python has its own warts > comparable to some of those you mention, but not all.  What bothers me > most is when "practicality beats purity" is invoked, with practicality > defined as "doing it this way

Re: itertools.groupby usage to get structured data

2011-02-04 Thread Paul Rubin
Slafs writes: > What i want to have is: > a "big" nested dictionary with 'g1' values as 1st level keys and a > dictionary of aggregates and "subgroups" in it > > I was looking for a solution that would let me do that kind of > grouping with variable lists of 2) and 3) i.e. having also 'g3' as

Re: Create classes at runtnime

2011-02-04 Thread Chris Rebert
On Fri, Feb 4, 2011 at 6:10 PM, Steven D'Aprano wrote: > On Fri, 04 Feb 2011 17:19:23 -0800, Ian wrote: >> On Feb 4, 5:49 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: >>> Just add in the class attributes you want after creating the class. > [...] >> This would probably cause some

Re: itertools.groupby usage to get structured data

2011-02-04 Thread Steven D'Aprano
On Fri, 04 Feb 2011 15:14:24 -0800, Slafs wrote: > Hi there! > > I'm having trouble to wrap my brain around this kind of problem: Perhaps you should consider backing up and staring from somewhere else with different input data, or changing the requirements. Just a thought. > What I have : >

Re: Create classes at runtnime

2011-02-04 Thread Steven D'Aprano
On Fri, 04 Feb 2011 17:19:23 -0800, Ian wrote: > On Feb 4, 5:49 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Just add in the class attributes you want after creating the class. [...] > This would probably cause some problems with the Django metaclass. It > inspects the class di

Tk Tablelist embedded window

2011-02-04 Thread - -
I have some really Tcl code which I would like to run in Python: package require Tk package require Tablelist proc main {} { tablelist::tablelist .t -columns {0 Test} -stretch 1 .t insert end {{} {}} .t cellconfigure end,0 -window {createWindow} .t insert end {{} {}} .t cellconfigure end,0 -window

Re: Create classes at runtnime

2011-02-04 Thread Ian
On Feb 4, 5:49 pm, Steven D'Aprano wrote: > Just add in the class attributes you want after creating the class. > > class VirtualUserLimitForm(ModelForm): >     pass > > f = forms.CharField  # alias for brevity > for name, value in [ >     ('swap_limit', f(max_length=100, initial=monitor1.default_

Re: Create classes at runtnime

2011-02-04 Thread Steven D'Aprano
On Fri, 04 Feb 2011 11:17:39 -0800, Marc Aymerich wrote: > Hi! > I need to create a pretty complex class at runtime. something like this > one: > > (note: "" means that the number of attributes can be variable) > > class VirtualUserLimitForm(ModelForm): > swap_limit = forms.CharField(max_

Re: Algorithm for generating pitch-class sets in prime form

2011-02-04 Thread Charles Turner
Hi- Do you knowof Christopher Ariza's AthenaCL? HTH, Charles -- http://mail.python.org/mailman/listinfo/python-list

Plumber, an alternative to mixin-based subclassing

2011-02-04 Thread Florian Friesdorf
An alternative to mixin-based subclassing: http://pypi.python.org/pypi/plumber -- Florian Friesdorf GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC -- http://mail.python.org/mailman/listinfo/python-list

Re: using attributes as defaults

2011-02-04 Thread Westley Martínez
On Fri, 2011-02-04 at 13:08 -0800, Wanderer wrote: > I want to give the option of changing attributes in a method or using > the current values of the attributes as the default. > > class MyClass(): > """ my Class > """ > def __init__(self): > """ initialize >

Re: shared python module ?

2011-02-04 Thread Westley Martínez
On Fri, 2011-02-04 at 22:36 +0530, km wrote: > Hi all, > > I have two version of python 2.6 and 2.7. > Now Is there any way that I install a python module (from pypi) and > import it across both the versions ? > > regards, > KM Simply install it twice, for each version, e.g.: % cd % python

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread Stephen Hansen
On 2/4/11 3:01 PM, rantingrick wrote: >> Put your money where your mouth is. > > ditto! I thought as much. My money is where my mouth is: but that is not IDLE, as I have no use for it and no interest in it at all. The status quo with regards to IDLE is satisfactory to me. You're the one talking

itertools.groupby usage to get structured data

2011-02-04 Thread Slafs
Hi there! I'm having trouble to wrap my brain around this kind of problem: What I have : 1) list of dicts 2) list of keys that i would like to be my grouping arguments of elements from 1) 3) list of keys that i would like do "aggregation" on the elements of 1) with some function e.g. sum F

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread rantingrick
On Feb 4, 12:49 pm, Stephen Hansen wrote: > On 2/4/11 10:34 AM, rantingrick wrote: > > > But we need to receive the old idlefork or > > have them delete the old idle fork as too much confusion will spread > > with when two idleforks exists. > > This is nonsense. And probably just another excuse fo

Re: Create classes at runtnime

2011-02-04 Thread Ian
On Feb 4, 2:32 pm, Peter Otten <__pete...@web.de> wrote: > > (note: "" means that the number of attributes can be variable) > > > class VirtualUserLimitForm(ModelForm): > >     swap_limit = forms.CharField(max_length=100, > > initial=monitor1.default_limit) > >     memory_limit = forms.CharFiel

Re: Create classes at runtnime

2011-02-04 Thread Carl Banks
On Feb 4, 11:17 am, Marc Aymerich wrote: > Hi! > I need to create a pretty complex class at runtime. something like > this one: > > (note: "" means that the number of attributes can be variable) > > class VirtualUserLimitForm(ModelForm): >     swap_limit = forms.CharField(max_length=100, > ini

Re: Create classes at runtnime

2011-02-04 Thread Carl Banks
On Feb 4, 1:32 pm, Peter Otten <__pete...@web.de> wrote: > Marc Aymerich wrote: > > I need to create a pretty complex class at runtime. something like > > this one: > > I have a hunch that you've never heard the famous Kernighan quote: > > "Everyone knows that debugging is twice as hard as writing

Re: Create classes at runtnime

2011-02-04 Thread Peter Otten
Marc Aymerich wrote: > I need to create a pretty complex class at runtime. something like > this one: I have a hunch that you've never heard the famous Kernighan quote: "Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be

Re: using attributes as defaults

2011-02-04 Thread Peter Otten
Wanderer wrote: > I want to give the option of changing attributes in a method or using > the current values of the attributes as the default. > > class MyClass(): > """ my Class > """ > def __init__(self): > """ initialize > """ > self.a = 3 >

Re: using attributes as defaults

2011-02-04 Thread Emile van Sebille
On 2/4/2011 1:08 PM Wanderer said... I want to give the option of changing attributes in a method or using the current values of the attributes as the default. class MyClass(): """ my Class """ def __init__(self): """ initialize """ self.a = 3

Re: using attributes as defaults

2011-02-04 Thread Stephen Hansen
On 2/4/11 1:08 PM, Wanderer wrote: > I want to give the option of changing attributes in a method or using > the current values of the attributes as the default. > > class MyClass(): > """ my Class > """ > def __init__(self): > """ initialize > """ > s

using attributes as defaults

2011-02-04 Thread Wanderer
I want to give the option of changing attributes in a method or using the current values of the attributes as the default. class MyClass(): """ my Class """ def __init__(self): """ initialize """ self.a = 3 self.b = 4 def MyMethod(self,

Re: Download an attachment from an IMAP email

2011-02-04 Thread Vincent Davis
hgc On Thu, Feb 3, 2011 at 6:52 PM, Kushal Kumaran < kushal.kumaran+pyt...@gmail.com > wrote: > On Fri, Feb 4, 2011 at 3:44 AM, Vincent Davis > wrote: > > I have a few emails I am trying to download from my google account. I > seem > > to be getting the message but each of these messages have a

Re: How to debug a problem with python crashing under windows

2011-02-04 Thread Terry Reedy
On 2/4/2011 11:41 AM, Miki Tebeka wrote: With crashing I mean, that windows pops up a screen saying, that python.exe failed. I do not have any usable trace on stdout / stderr. What are the best means to analyze such errors? You can use sys.excepthook to catch uncaught exceptions. See http://py

Create classes at runtnime

2011-02-04 Thread Marc Aymerich
Hi! I need to create a pretty complex class at runtime. something like this one: (note: "" means that the number of attributes can be variable) class VirtualUserLimitForm(ModelForm): swap_limit = forms.CharField(max_length=100, initial=monitor1.default_limit) memory_limit = forms.Char

Re: Use the Source Luke

2011-02-04 Thread OKB (not okblacke)
rusi wrote: > On Feb 2, 12:32 am, "OKB (not okblacke)" >>         I think, in general, the less anyone needs to know C even >> exists, the better for Python; likewise, the more that people have >> to mention the existence of C in a Python context, the worse for >> Python.  This may be a somewhat e

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread Stephen Hansen
On 2/4/11 10:34 AM, rantingrick wrote: > But we need to receive the old idlefork or > have them delete the old idle fork as too much confusion will spread > with when two idleforks exists. This is nonsense. And probably just another excuse for you to rant instead of actually doing something of any

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread rantingrick
On Feb 4, 3:55 am, flebber wrote: > Enough talk ratingrick where is your feature and request tracker for > your idle fork? How can people assist you in your new idle fork > project? What are your stated project goals & timeline? I am ready flebber but we have a problem. An old IDLE fork project

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread rantingrick
On Feb 3, 11:15 am, rantingrick wrote: > If anyone would like to see a good example of how IDLE code should be > written. I highly suggest you check out the source for PyShell and > PyCrust which is located in roughly... > > HOME\PythonXX\Lib\site-packages\wx-2.8-msw-ansi\wx\py: >  * shell.py >  *

Re: socket.rcv timeout while-loop

2011-02-04 Thread Stephen Hansen
On 2/4/11 9:16 AM, Dwayne Blind wrote: > @ Stephen Hansen > Now I am pretty much worried. :'( Why? This is all sounding like a problem that isn't actually a problem. I think you may have over-analyzed yourself into a corner and think you have something to solve which doesn't really need solving.

Re: socket.rcv timeout while-loop

2011-02-04 Thread Dwayne Blind
Thank you very much Jean-Michel Pichavant and Stephen Hansen. @ Jean-Michel Pichavant I will have a look at Pyro. @ Stephen Hansen Now I am pretty much worried. :'( 2011/2/4 Stephen Hansen > On 2/4/11 6:55 AM, Dwayne Blind wrote: > > @ Jean-Michel Pichavant > > I am writing a small multipla

Re: Converging Multiple Classes

2011-02-04 Thread Wanderer
On Feb 4, 12:07 pm, Jean-Michel Pichavant wrote: > Wanderer wrote: > > I have a bunch of cameras I want to run tests on. They each have > > different drivers and interfaces. What I want to do is create python > > wrappers so that they all have a common interface and can be called by > > the same p

Re: Converging Multiple Classes

2011-02-04 Thread Jean-Michel Pichavant
Wanderer wrote: I have a bunch of cameras I want to run tests on. They each have different drivers and interfaces. What I want to do is create python wrappers so that they all have a common interface and can be called by the same python test bench program. I'm not sure what to call it. I don't th

shared python module ?

2011-02-04 Thread km
Hi all, I have two version of python 2.6 and 2.7. Now Is there any way that I install a python module (from pypi) and import it across both the versions ? regards, KM -- http://mail.python.org/mailman/listinfo/python-list

Re: Use the Source Luke

2011-02-04 Thread rusi
On Feb 4, 9:34 pm, rusi wrote: > > [PS Does not read properly in google docs though it reads ok in > acroread and evince ] Sorry google docs does not like the pdf Heres a ps https://docs.google.com/leaf?id=0B3gsacOF56PxOWUxZTVmOTQtYWIxNy00ZGFjLWEwODUtZDVkM2MyZGI5ZmRk&hl=en -- http://mail.python

Re: socket.rcv timeout while-loop

2011-02-04 Thread Stephen Hansen
On 2/4/11 6:55 AM, Dwayne Blind wrote: > @ Jean-Michel Pichavant > I am writing a small multiplayer game. Several clients are connected to > the server. Games last, say, 20 seconds. > You can think of the game as a small chat lasting 20 seconds. All the > data received by the server is sent back to

Re: Converging Multiple Classes

2011-02-04 Thread George Silva
Take a look at the strategy pattern. But with python being a dinamic language, you probably won't need to implement it like that. http://en.wikipedia.org/wiki/Strategy_pattern Example: # import all you need CAMERAS = ['A','B','C'] def capture_A: pass def capture_B: pass def capture_C: pass

Re: How to debug a problem with python crashing under windows

2011-02-04 Thread Miki Tebeka
> With crashing I mean, that windows pops up a screen saying, that > python.exe failed. > I do not have any usable trace on stdout / stderr. > > What are the best means to analyze such errors? You can use sys.excepthook to catch uncaught exceptions. See http://pythonwise.blogspot.com/2008/12/cras

Converging Multiple Classes

2011-02-04 Thread Wanderer
I have a bunch of cameras I want to run tests on. They each have different drivers and interfaces. What I want to do is create python wrappers so that they all have a common interface and can be called by the same python test bench program. I'm not sure what to call it. I don't think it's inheritan

Re: Use the Source Luke

2011-02-04 Thread rusi
On Feb 2, 12:32 am, "OKB (not okblacke)" wrote: > Tim Wintle wrote: > > (2) is especially important IMO - under half of the python > > developers I have regularly worked with would feel comfortable > > reading C - so for the other half reading C source code probably > > isn't going to help them un

Re-installing 2.6.6 to build shared library

2011-02-04 Thread octopusgrabbus
In order to accommodate a mod_wsgi build problem, I need to have a Python shared library. What is the best way to re-install Python to do this? Many thanks. cmn -- http://mail.python.org/mailman/listinfo/python-list

Re: Reassign or discard Popen().stdout from a server process

2011-02-04 Thread John O'Hagan
On Thu, 3 Feb 2011, Nobody wrote: > On Tue, 01 Feb 2011 08:30:19 +, John O'Hagan wrote: > > I can't keep reading because that will block - there won't be any more > > output until I send some input, and I don't want it in any case. > > > > To try to fix this I added: > > > > proc.stdout = os.

Re: socket.rcv timeout while-loop

2011-02-04 Thread Jean-Michel Pichavant
Dwayne Blind wrote: Thanks to all of you. @ Jean-Michel Pichavant I am writing a small multiplayer game. Several clients are connected to the server. Games last, say, 20 seconds. You can think of the game as a small chat lasting 20 seconds. All the data received by the server is sent back to

Re: socket.rcv timeout while-loop

2011-02-04 Thread Dwayne Blind
Thanks to all of you. @ Jean-Michel Pichavant I am writing a small multiplayer game. Several clients are connected to the server. Games last, say, 20 seconds. You can think of the game as a small chat lasting 20 seconds. All the data received by the server is sent back to the clients. @ Stephen H

How to debug a problem with python crashing under windows

2011-02-04 Thread gelonida
Hi, I have a python application, which occasionally crashes. With crashing I mean, that windows pops up a screen saying, that python.exe failed. I do not have any usable trace on stdout / stderr. What are the best means to analyze such errors? Is there any way to get something like a core dump

Deadlock and a rather weird stacktrace

2011-02-04 Thread Vincent van Beveren
Hi everyone, I'm currently working on a multithreaded GUI system in Python 2.6. In this system I use conditions to coordinate synchronization. However, one condition suddenly locks, without any cause. As a last resort I have written a small routine to dump all the stack traces. def dumpAl

Re: socket.rcv timeout while-loop

2011-02-04 Thread Jean-Michel Pichavant
Stephen Hansen wrote: On 2/3/11 9:56 AM, Dwayne Blind wrote: However I would like to set timeout on the socket rcv method, so that the while loop stops exactly after 3 seconds. Is this possible ? I rarely do low-level socket stuff -- [snip] Good point. Python has a module for almos

Re: code structure advise for a model

2011-02-04 Thread Peter Otten
Martin De Kauwe wrote: > I am translating some c++ code to python and just wanted to ask some > advise on structure. The original has everything declared globally and > nothing passed via function (I assume, but don't know, that this isn't > just standard c++ practice!). So given this, I have a pr

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-04 Thread flebber
On Feb 3, 7:41 am, Corey Richardson wrote: > On 2/2/2011 2:44 PM, rantingrick wrote: > > Will you be forking IDLE and setting up some sort of tracker for > improvements? +1 for this. Enough talk ratingrick where is your feature and request tracker for your idle fork? How can people assist you i

Re: code structure advise for a model

2011-02-04 Thread Marco Nawijn
On Feb 4, 3:43 am, Martin De Kauwe wrote: > Hi, > > I am translating some c++ code to python and just wanted to ask some > advise on structure. The original has everything declared globally and > nothing passed via function (I assume, but don't know, that this isn't > just standard c++ practice!).