Re: Classes as namespaces?

2010-03-27 Thread Raymond Hettinger
On Mar 26, 7:49 am, kj wrote: > What's the word on using "classes as namespaces"?  E.g. > > class _cfg(object): >     spam = 1 >     jambon = 3 >     huevos = 2 > > breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Works for me. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: GIF89A and PIL

2010-03-27 Thread Chris Colbert
since the images only use a couple colors each, just run length encode it. Depending on the image, you may be able to get a super small size that way, and avoid the whole mess. On Sat, Mar 27, 2010 at 11:32 PM, Harishankar wrote: > On Sat, 27 Mar 2010 19:44:54 -0700, Stephen Hansen wrote: > > > O

Re: Classes as namespaces?

2010-03-27 Thread Stephen Hansen
On 2010-03-26 07:49:02 -0700, kj said: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Granted, this is not the "intended use" for classes, and therefore could be viewed a

Re: GIF89A and PIL

2010-03-27 Thread Harishankar
On Sat, 27 Mar 2010 19:44:54 -0700, Stephen Hansen wrote: > On 2010-03-27 08:17:46 -0700, Alain Ketterlin said: > >> Stephen Hansen writes: > >>> If not, are there any decent other image libraries out there that >>> anyone's familiar with? The only one I could find was PythonMagick, >>> which s

Re: GIF89A and PIL

2010-03-27 Thread Stephen Hansen
On 2010-03-27 08:17:46 -0700, Alain Ketterlin said: Stephen Hansen writes: If not, are there any decent other image libraries out there that anyone's familiar with? The only one I could find was PythonMagick, which seems completely undocumented. Or I'm blind. I don't know PythonMagick, but

Re: Ipython(x,y) Won't Run

2010-03-27 Thread Robert Kern
On 2010-03-27 11:21 , Larry Kizer wrote: I uninstalled my previous version of Python and installed Python(x,y) ver 2.6.2.0 in Windows XP - Install seemed to work fine but when I try to run Ipython(x,y) I get the following error: python.exe has encountered a problem and needs to close. We are sor

Re: Simple Traits Questions

2010-03-27 Thread Robert Kern
On 2010-03-27 08:19 , Ethan Furman wrote: Okay, different post for my actual questions. :) On the PyPI page for strait (http://pypi.python.org/pypi/strait/0.5.1) it has the example of choosing which methods to keep in the composed class: class TOSWidget(BaseWidget): __metaclass__ = include(Pac

Re: Classes as namespaces?

2010-03-27 Thread Gregory Ewing
kj wrote: What's the word on using "classes as namespaces"? My only concern would be that classes do magical things with certain types when you retrieve them as attributes (e.g. functions, property descriptors), so you can't use one as a completely general purpose transparent container. But for

"jobs in usa for foreigners" "jobs in usa hotels" "jobs in usa for uk citizens" "usa jobs" "usa jobs in afghanistan" "usa jobs application manager" "usa jobs for non us citizens" on http://jobsinusa-

2010-03-27 Thread saima81
"jobs in usa for foreigners" "jobs in usa hotels" "jobs in usa for uk citizens" "usa jobs" "usa jobs in afghanistan" "usa jobs application manager" "usa jobs for non us citizens" on http://jobsinusa-net.blogspot.com/ "jobs in usa for foreigners" "jobs in usa hotels" "jobs in usa for uk citizens" "u

Re: Classes as namespaces?

2010-03-27 Thread Gregory Ewing
Jonathan Hartley wrote: def account_for_non_square_pixels(x): ((some complex logic)) account_for_non_square_pixels() class account_for_non_square_pixels: ((some complex logic)) I don't see much advantage -- you're still leaving behind an object that won't be used again. If you're conc

Re: Automatic import ?

2010-03-27 Thread C. B.
> In that particular case, replace automatic by implicit, and you got the > reason why it is not a good idea. > Maybe in your case the C habits clashes to the python habits. > You're right ! As a C developer, I appreciate to only include to deal with strings, without wondering which other heade

Python Psycopg2 - Interface Error : Connection already closed

2010-03-27 Thread knobbyknees
I'm not sure if this is the right group, but I'm hoping it is... Basically, I'm trying to use pgloader, which depends on python and psycopg2. After banging my head against a wall, I found this: Found this: http://www.mail-archive.com/sqlalch...@googlegroups.com/msg13209.html Although, the sugge

Re: StringChain -- a data structure for managing large sequences of chunks of bytes

2010-03-27 Thread Lie Ryan
On 03/22/2010 07:07 PM, Steven D'Aprano wrote: > Perhaps you should have said that it was a wrapper around deque giving > richer functionality, rather than giving the impression that it was a > brand new data structure invented by you. People are naturally going to > be more skeptical about a ne

Re: Vertical line in function arguments

2010-03-27 Thread Andrej Mitrovic
Well I hate it when this happens. I ask a question, and literally 2 seconds later I bump into the answer. This explains it a bit: http://docs.python.org/library/stdtypes.html#bit-string-operations-on-integer-types -- http://mail.python.org/mailman/listinfo/python-list

Vertical line in function arguments

2010-03-27 Thread Andrej Mitrovic
There is this peace of code in a 3rd party module: MidiIn.SetFilter(pypm.FILT_ACTIVE | pypm.FILT_CLOCK | pypm.FILT_PITCHBEND | pypm.FILT_NOTE) What are the vertical lines in a function call such as this? This actually calls a function from a Pyrex module that was compiled int

Re: Classes as namespaces?

2010-03-27 Thread Patrick Maupin
On Mar 27, 12:10 pm, Terry Reedy wrote: > On 3/27/2010 7:28 AM, Jonathan Hartley wrote: > > > On Mar 26, 6:26 pm, Luis M. González  wrote: > > But defining and then calling the function like that is a tad > > cumbersome. So I was wondering about: > > > x = 1 > > class account_for_non_square_pixels

Re: function decorator-like function

2010-03-27 Thread Patrick Maupin
On Mar 27, 11:24 am, vsoler wrote: > I see what happened. The first line was somehow hidden. > Thank you very much. You're welcome. Sorry about the formatting. Also, note that if your decorator is complicated, you might want to use a class instead of a nested function. Here's the same thing, u

Re: Classes as namespaces?

2010-03-27 Thread Terry Reedy
On 3/27/2010 7:28 AM, Jonathan Hartley wrote: On Mar 26, 6:26 pm, Luis M. González wrote: But defining and then calling the function like that is a tad cumbersome. So I was wondering about: x = 1 class account_for_non_square_pixels: ((some complex logic)) y = 2 I don't exactly like th

Re: Python database of plain text editable by notepad or vi

2010-03-27 Thread James Harris
On 26 Mar, 14:58, Jon Clements wrote: > On 26 Mar, 09:49, James Harris wrote: ... > > I'm toying with some > > ideas for a way to help generate source code (in various languages, > > not just Python). If it goes ahead the text files would be mainly > > marked-up code snippets - with or without sy

Re: Re: Super() function

2010-03-27 Thread Alan Harris-Reid
Gabriel Genellina wrote: En Thu, 25 Mar 2010 00:17:52 -0300, Alan Harris-Reid escribió: Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way of

Re: function decorator-like function

2010-03-27 Thread vsoler
On 27 mar, 17:21, vsoler wrote: > On 27 mar, 17:06, Patrick Maupin wrote: > > > > > On Mar 27, 10:24 am, vsoler wrote: > > > > Hi, > > > > Still learning Python, now decorators. > > > > Before diving deeply into decorators, I'd like to apply a function to > > > another function. > > > > My "extr

Re: function decorator-like function

2010-03-27 Thread vsoler
On 27 mar, 17:06, Patrick Maupin wrote: > On Mar 27, 10:24 am, vsoler wrote: > > > > > Hi, > > > Still learning Python, now decorators. > > > Before diving deeply into decorators, I'd like to apply a function to > > another function. > > > My "extremely simple function" should print number 3, the

Ipython(x,y) Won't Run

2010-03-27 Thread Larry Kizer
I uninstalled my previous version of Python and installed Python(x,y) ver 2.6.2.0 in Windows XP - Install seemed to work fine but when I try to run Ipython(x,y) I get the following error: python.exe has encountered a problem and needs to close. We are sorry for the inconvenience. Any ideas? Thank

Re: function decorator-like function

2010-03-27 Thread Patrick Maupin
On Mar 27, 10:24 am, vsoler wrote: > Hi, > > Still learning Python, now decorators. > > Before diving deeply into decorators, I'd like to apply a function to > another function. > > My "extremely simple function" should print number 3, then the sum of > its 2 arguments. > > Say that I call   f(5,7

function decorator-like function

2010-03-27 Thread vsoler
Hi, Still learning Python, now decorators. Before diving deeply into decorators, I'd like to apply a function to another function. My "extremely simple function" should print number 3, then the sum of its 2 arguments. Say that I call f(5,7) I'd like to get, somehow, 3 then 12. I've tried the

Re: GIF89A and PIL

2010-03-27 Thread Alain Ketterlin
Stephen Hansen writes: > Is it possible to get PIL to save GIF's in GIF89A format, instead of > GIF87A? GIF89 was patented. I guess that is why it isn't used by PIL. (The patent has expired now, IIRC.) Anyway, PNG was supposed to replace GIF. > If not, are there any decent other image libraries

Re: Any examples/documentation for python-newt

2010-03-27 Thread Harishankar
On Sat, 27 Mar 2010 14:56:30 +, Grant Edwards wrote: > On 2010-03-27, Harishankar wrote: > >>> I've used it for some trivial stuff, but not for anything very >>> sophisticated. Redhat's text-mode installer program (anaconda) was >>> written in Python using Newt (I believe it is why Newt was

Re: Re: Super() function

2010-03-27 Thread Alan Harris-Reid
³p wrote: Hi: On 25 March 2010 11:17, Alan Harris-Reid > wrote: Hi, Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() so

Re: Any examples/documentation for python-newt

2010-03-27 Thread Grant Edwards
On 2010-03-27, Harishankar wrote: >> I've used it for some trivial stuff, but not for anything very >> sophisticated. Redhat's text-mode installer program (anaconda) was >> written in Python using Newt (I believe it is why Newt was invented). >> That's probably the most "full featured" example I

Re: Any examples/documentation for python-newt

2010-03-27 Thread Harishankar
On Sat, 27 Mar 2010 14:44:23 +, Grant Edwards wrote: > On 2010-03-27, Harishankar wrote: >> I am writing a fairly featureful TUI in python and I figured newt is >> the best lightweight TUI which actually offers widgets. curses is low >> level and its text editing capabilities are poor while U

Re: Any examples/documentation for python-newt

2010-03-27 Thread Grant Edwards
On 2010-03-27, Harishankar wrote: > I am writing a fairly featureful TUI in python and I figured newt is the > best lightweight TUI which actually offers widgets. curses is low level > and its text editing capabilities are poor while UIs like urwid and stfl > too complex for simple programs lik

Re: Classes as namespaces?

2010-03-27 Thread Ethan Furman
Jonathan Hartley wrote: Hey everyone. By coincidence, only yesterday I was wondering about using classes as a way of labeling a block of code, ie. an lightweight alternative to defining a function that would only be called from one location. eg. instead of: x = 1 ((some complex logic)) y = 2

Call for papers (Deadline Extended): SETP-10, USA, July 2010

2010-03-27 Thread James Heralds
It would be highly appreciated if you could share this announcement with your colleagues, students and individuals whose research is in software engineering, software testing, software quality assurance, software design and related areas. Call for papers (Deadline Extended): SETP-10, USA, July 201

Re: Classes as namespaces?

2010-03-27 Thread Philip Semanchuk
On Mar 27, 2010, at 8:04 AM, J. Clifford Dyer wrote: On Fri, Mar 26, 2010 at 02:49:02PM +, kj wrote regarding Classes as namespaces?: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon,

Simple Traits

2010-03-27 Thread Ethan Furman
Wow. I just stumbled across one of Michele Simionato's offerings, called simple traits (strait for short) which looks *really* cool. You can find it here: http://pypi.python.org/pypi/strait/0.5.1 Extremely quick summary: Instead of multiple inheritance, with it's range of problems, use singl

Simple Traits Questions

2010-03-27 Thread Ethan Furman
Okay, different post for my actual questions. :) On the PyPI page for strait (http://pypi.python.org/pypi/strait/0.5.1) it has the example of choosing which methods to keep in the composed class: class TOSWidget(BaseWidget): __metaclass__ = include(Pack, Place, Grid) info = Pack.info.

Re: Automatic import ?

2010-03-27 Thread Jean-Michel Pichavant
C. B. wrote: [snip] It takes time to write the relative importations, that's ok, but I think it could be more pleasant for the end-user to not have to write a huge list of "from mymodule import xxx" if it is possible to take advantage of automatic importations. Cheers, In that particular ca

Re: Classes as namespaces?

2010-03-27 Thread Steve Holden
J. Clifford Dyer wrote: > On Fri, Mar 26, 2010 at 02:49:02PM +, kj wrote regarding Classes > as namespaces?: >> What's the word on using "classes as namespaces"? E.g. >> >> class _cfg(object): spam = 1 jambon = 3 huevos = 2 >> >> breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) >> [...] >

Re: Classes as namespaces?

2010-03-27 Thread J. Clifford Dyer
On Fri, Mar 26, 2010 at 02:49:02PM +, kj wrote regarding Classes as namespaces?: > > What's the word on using "classes as namespaces"? E.g. > > class _cfg(object): > spam = 1 > jambon = 3 > huevos = 2 > > breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) > > > Granted, this

Re: Classes as namespaces?

2010-03-27 Thread J. Clifford Dyer
On Sat, Mar 27, 2010 at 04:28:56AM -0700, Jonathan Hartley wrote regarding Re: Classes as namespaces?: > > Hey everyone. By coincidence, only yesterday I was wondering about > using classes as a way of labeling a block of code, ie. an lightweight > alternative to defining a function that would on

Re: Classes as namespaces?

2010-03-27 Thread Jean-Michel Pichavant
Jonathan Hartley wrote: On Mar 26, 6:26 pm, Luis M. González wrote: On 26 mar, 11:49, kj wrote: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)

Re: Classes as namespaces?

2010-03-27 Thread Jonathan Hartley
On Mar 26, 6:26 pm, Luis M. González wrote: > On 26 mar, 11:49, kj wrote: > > > What's the word on using "classes as namespaces"?  E.g. > > > class _cfg(object): > >     spam = 1 > >     jambon = 3 > >     huevos = 2 > > > breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) > > I see no problem. >

Any examples/documentation for python-newt

2010-03-27 Thread Harishankar
I am writing a fairly featureful TUI in python and I figured newt is the best lightweight TUI which actually offers widgets. curses is low level and its text editing capabilities are poor while UIs like urwid and stfl too complex for simple programs like the ones I am creating. Could anybody po

Re: sum for sequences?

2010-03-27 Thread Steven D'Aprano
On Fri, 26 Mar 2010 07:31:17 -0700, Steve Howell wrote: > From a purely academic standpoint, I'm not convinced that sum() is > inefficient in terms of big-O complexity, though. > > show...@showell-laptop:~$ python > Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on > linux2

Re: Traversing through Dir()

2010-03-27 Thread Dave Angel
Andrej Mitrovic wrote: On Mar 26, 9:18 am, "Alf P. Steinbach" wrote: hierarchy =nspect.getclasstree( classes ) # 'hierarchy' is a list array of tuples and nested list arrays of the same form. # The top level is an array of two items, the first item a tuple describing the 'object' # class,

Hello,everybody,the good shoping place,the new year approaching, click in. Let's facelift bar! ===== HTTP://loveshopping.us ====

2010-03-27 Thread marrylin
Hello,everybody,the good shoping place,the new year approaching, click in. Let's facelift bar! = HTTP://loveshopping.us Air jordan(1-24)shoes $33 UGG BOOT $50 Nike shox(R4,NZ,OZ,TL1,TL2,TL3) $35 Handbags(Coach lv fendi d&g) $35 Tshirts (Polo ,ed hardy,lacoste) $16 Jean(True Religio