Re: Where is Python in the scheme of things?

2006-10-04 Thread Virgil Dupras
On Oct 4, 4:21 pm, "gord" <[EMAIL PROTECTED]> wrote: > As a complete novice in the study of Python, I am asking myself where this > language is superior or better suited than others. For example, all I see in > the tutorials are lots of examples of list processing, arithmetic > calculations - all

Re: Names changed to protect the guilty

2006-10-06 Thread Virgil Dupras
MonkeeSage wrote: > On Oct 6, 6:27 pm, [EMAIL PROTECTED] (Aahz) wrote: > > The following line of lightly munged code was found in a publicly > > available Python library... > > Yes, this violates the Holy, Inspired, Infallible Style Guide (pbuh), > which was written by the very finger of God when

Re: reduce to be removed?

2006-11-11 Thread Virgil Dupras
Dustan wrote: > According to the following page on Wikipedia: > http://en.wikipedia.org/wiki/Python_%28programming_language%29#Future_development > reduce is going to be removed in python 3.0. It talks of an > accumulation loop; I have no idea what that's supposed to mean. So, > >

Re: byte count unicode string

2006-09-20 Thread Virgil Dupras
MonkeeSage wrote: > OK, so the devil always loses. ;P > > Regards, > Jordan Huh? The devil always loses? *turns TV on, watches the news, turns TV off* Nope, buddy. Quite the contrary. -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting device addresses into parts

2006-09-26 Thread Virgil Dupras
Fabian Steiner wrote: > I often have to deal with strings like "PCI:2:3.0" or "PCI:3.4:0" and > need the single numbers as tuple (2, 3, 0) or (3, 4, 0). Is there any > simple way to achieve this? So far I am using regular expressions but I > would like to avoid them ... > > Regards, > Fabian Steine

Re: About the 79 character line recommendation

2006-12-05 Thread Virgil Dupras
Steve Bergman wrote: > As I study Python, I am trying to develop good, Pythonic, habits. For > one thing, I am trying to keep Guido's the style guide in mind. > > And I know that it starts out saying that it should not be applied in > an absolute fashion. > > However, I am finding that the 79 char

Refactoring test units after an extract method

2007-06-05 Thread Virgil Dupras
This is not strictly python related, but it's not strictly TDD related either. Anyway, here it goes. There's something that I was never quite sure how to handle with test units: How to handle the test unit refactoring after a method extraction. Let's say that you have a function foo() that does A

Re: Decorating class member functions

2007-05-03 Thread Virgil Dupras
On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote: > Okay does anyone know how to decorate class member functions? > > The following code gives me an error: > > Traceback (most recent call last): > File "decorators2.py", line 33, in > s.update() > File "decorators2.py", line 13, in

Re: Decorating class member functions

2007-05-03 Thread Virgil Dupras
On May 3, 9:33 pm, Virgil Dupras <[EMAIL PROTECTED]> wrote: > On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote: > > > > > Okay does anyone know how to decorate class member functions? > > > The following code gives me an error: > > &g

Re: Decorating class member functions

2007-05-03 Thread Virgil Dupras
On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote: > Okay does anyone know how to decorate class member functions? > > The following code gives me an error: > > Traceback (most recent call last): > File "decorators2.py", line 33, in > s.update() > File "decorators2.py", line 13, in

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-13 Thread Virgil Dupras
On May 13, 11:44 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > PEP 1 specifies that PEP authors need to collect feedback from the > community. As the author of PEP 3131, I'd like to encourage comments > to the PEP included below, either here (comp.lang.python), or to > [EMAIL PROTECTED] > > In

Re: Good Python style?

2007-05-31 Thread Virgil Dupras
On May 31, 3:59 am, Andreas Beyer <[EMAIL PROTECTED]> wrote: > Hi, > > I found the following quite cryptic code, which basically reads the > first column of some_file into a set. > In Python I am used to seeing much more verbose/explicit code. However, > the example below _may_ actually be faster t

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Virgil Dupras
On Mar 7, 7:14 pm, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm looking for an easy way to flatten a two level list like this > > spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] > > Into something like > eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] > > There are *no* special c

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Virgil Dupras
On Mar 21, 9:24 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Marcin Ciura wrote: > > Steven D'Aprano wrote: > > x, y, z = 1, 2, 3 > > x = y = z > > x, y, z > >> (3, 3, 3) > > >> I certainly wouldn't expect to get (2, 3, 3). > > > Neither would I. I must have expressed myself not clearl

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-21 Thread Virgil Dupras
On Mar 21, 10:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Virgil Dupras wrote: > > On Mar 21, 9:24 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > >> Marcin Ciura wrote: > >>> Steven D'Aprano wrote: > >>>>>>> x, y, z =

Re: Matching Directory Names and Grouping Them

2007-01-11 Thread Virgil Dupras
>From your example, if you want to group every path that has the same last 9 characters, a simple solution could be something like: groups = {} for path in paths: group = groups.setdefault(path[-9:],[]) group.append(path) I didn't actually test it, there ight be syntax errors. J wrote: >

Re: Inheriting str object

2007-02-05 Thread Virgil Dupras
On Feb 5, 5:48 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I want to have a str with custom methods, but I have this problem: > > class myStr(str): > def hello(self): > return 'hello '+self > > s=myStr('world') > print s.hello() # prints 'hello world' > s=s.upper() > print s.he

Re: Nested Parameter Definitions

2007-02-25 Thread Virgil Dupras
On Feb 25, 1:00 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > I blogged on finding a new-to-me feature of Python, in that you are > allowed to nnest parameter definitions: > > >>> def x ((p0, p1), p2): > > ... return p0,p1,p2 > ...>>> x(('Does', 'this'), 'work') > > ('Does', 'this', 'work') > > > >

Re: Any simpler way to do this

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:37 am, Lars Johansen <[EMAIL PROTECTED]> wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": >

Re: Dictionary instantiation?

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:05 am, Matt_D <[EMAIL PROTECTED]> wrote: > Hello there, this is my first post to the list. Only been working with > Python for a few days. Basically a complete newbie to programming. > > I'm working with csv module as an exercise to parse out a spreadsheet > I use for work.(I am an edit

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:03 am, grbgooglefan <[EMAIL PROTECTED]> wrote: > On Dec 7, 3:07 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Fri, 07 Dec 2007 01:24:57 -0300, grbgooglefan <[EMAIL PROTECTED]> > > escribió: > > > > On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > > wro

Re: Best way to protect my new commercial software.

2007-12-10 Thread Virgil Dupras
On Dec 10, 8:15 am, farsheed <[EMAIL PROTECTED]> wrote: > I wrote a software and I want to protect it so can not be cracked > easily. I wrote it in python and compile it using py2exe. what is the > best way in your opinion? Don't. This is a fight you already lost. Besides, people who crack softwar

Re: a Python person's experience with Ruby

2007-12-10 Thread Virgil Dupras
On Dec 9, 1:15 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Richard Jones a écrit : > > > > > Bruno Desthuilliers wrote: > > >>class A(object): > >> @apply > >> def a(): > >> def fget(self): > >> return self._a > >> def fset(self, val): > >> self._a = val > >> re

Re: Best way to protect my new commercial software.

2007-12-10 Thread Virgil Dupras
On Dec 10, 9:55 am, farsheed <[EMAIL PROTECTED]> wrote: > Thanks. But I ask this question technically, I mean I know nothing is > uncrackable and popular softwares are not well protected. But my > software is not that type and I don't want this specific software > popular. > It is some kind of in h

Re: Test driven development

2008-01-24 Thread Virgil Dupras
On Jan 24, 7:37 am, [EMAIL PROTECTED] wrote: > Hi > > Sorry if this is a bit off topic but as unit testing is such a > cornerstone of python development I thought a few of you may be able > to share your knowledge/experiences. > > I like the concept of TDD but find it difficult to put into practice

Re: Test driven development

2008-01-24 Thread Virgil Dupras
On Jan 24, 1:30 pm, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Virgil Dupras schreef: > > > I know what you mean by top-down vs. bottom-up and I used to have the > > same dilemma, but now I would tend to agree with Albert. Your issue > > with top-down or bottom-up is

Re: [Python-Dev] "as" keyword woes

2008-12-06 Thread Virgil Dupras
On 06 Dec 2008, at 20:38, Warren DeLano wrote: Date: Fri, 05 Dec 2008 22:22:38 -0800 From: Dennis Lee Bieber <[EMAIL PROTECTED]> Subject: Re: "as" keyword woes To: python-list@python.org Message-ID: <[EMAIL PROTECTED]> I'm still in the dark as to what type of data could even inspire t

Re: Class Inheritance - What am I doing wrong?

2008-04-24 Thread Virgil Dupras
On Apr 24, 10:22 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > My example: > > class A(object): > >         def __init__(self, name): >                 self.__name = name > >         def getName(self): >                 return self.__name > > class B(A): > >         def __init__(self,name=None): >

Re: Subclassing list the right way?

2008-04-25 Thread Virgil Dupras
On Apr 25, 4:03 pm, Kirk Strauser <[EMAIL PROTECTED]> wrote: > I want to subclass list so that each value in it is calculated at call > time.  I had initially thought I could do that by defining my own > __getitem__, but 1) apparently that's deprecated (although I can't > find that; got a link?), a