Re: Snackages [Re: is there enough information?]

2008-03-03 Thread Daniel Fetchinson
> >> Speak not of Wendy's -- they moved into town in my college days... > >> The "hot and juicy" was commonly taken to mean: patty dipped in pan > >> drippings, then nuked in microwave... And any CompSci person could > >> figure out that the "256 different ways" meant one had access to a tray > >>

Re: metaclasses

2008-03-03 Thread Daniel Fetchinson
> What are metaclasses? http://www.google.com/search?q=python+metaclass HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a class?

2008-03-05 Thread Daniel Fetchinson
> > Where to begin? > > What does exec( open( 'modA.py' ).read() ) do? The most appropriate list to ask those questions is: http://mail.python.org/mailman/listinfo/tutor -- http://mail.python.org/mailman/listinfo/python-list

Re: Green's Function

2008-03-08 Thread Daniel Fetchinson
> I am new to Python and trying to solve the Hamiltonian of a linear chair > of atoms using green's function. > Does anyone know any pre-existing library functions and literature that > could be helpful? You might find this helpful: http://scipy.org/ HTH, Daniel -- http://mail.python.org/mailman

image matching algorithms

2008-03-09 Thread Daniel Fetchinson
Hi all, There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> > There are a number of free tools for image matching but it's not very > > easy to decipher the actual algorithm from the code that includes db > > management, GUI, etc, etc. I have my own image database and GUI so all > > I need is the actual algorithm preferably in pseudo code and not in > > t

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> >>> There are a number of free tools for image matching but it's not very > >>> easy to decipher the actual algorithm from the code that includes db > >>> management, GUI, etc, etc. I have my own image database and GUI so all > >>> I need is the actual algorithm preferably in pseudo code and not

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> | The various free tools differ by their chosen optimization paths and > | their degree of specialization. My preference would be, > | > | 1. Doesn't really matter how long it takes to compute the N numbers per > image > > Your problem here is that there is really no such thing as 'general > feat

Re: image matching algorithms

2008-03-11 Thread Daniel Fetchinson
> The second thing I'll try (after trying > your suggestion) is based on this paper which I found in the meantime: > http://salesin.cs.washington.edu/abstracts.html#MultiresQuery > In case anyone is interested, it describes a multiresolution querying > algorithm and best of all, it has pseudo code

Re: image matching algorithms

2008-03-12 Thread Daniel Fetchinson
> > Thanks for the info! SIFT really looks like a heavy weight solution, > > but do you think the whole concept can be simplified if all I needed > > was: given a photo, find similar ones? I mean SIFT first detects > > objects on the image and find similarities, but I don't need the > > detection p

Re: image matching algorithms

2008-03-12 Thread Daniel Fetchinson
> > The photos are just coming straight from my digital camera. Same > > format (JPEG), varying size (6-10 megapixel) and I would like to be > > able to pick one and then query the database for similar ones. For > > example: I pick a photo which is more or less a portrait of someone, > > the query

Re: image matching algorithms

2008-03-13 Thread Daniel Fetchinson
> > Since you seem to know quite a bit about this topic, what is your > > opinion on the apparently 'generic' algorithm described here: > > http://grail.cs.washington.edu/projects/query/ ? > > So far it seems to me that it does what I'm asking for, it does even > > more because it can take a hand d

Re: First Program Bug (Newbie)

2008-03-17 Thread Daniel Fetchinson
> P.S. What is the chance I'll get spam for using my real email address? Exactly 1. > I currently don't get any so... ... you will get now. Sorry to disappoint you, but it's better to be prepared in advance than be shocked later :) Cheers, Daniel -- http://mail.python.org/mailman/listinfo/pyt

Removal of tkinter from python 3.0? [was: Fate of the repr module in Py3.0]

2008-03-20 Thread Daniel Fetchinson
> Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ , > and saw that the repr module was slated for vaporization. I've only > used the module a few times ever. I'm curious if the community wants > it kept around or whether it is considered clutter. > > The PEP is going to be finaliz

pep 3108

2008-03-20 Thread Daniel Fetchinson
Hi Brett, I've just looked through pep 3108 and since Raymond Hettinger suggested contacting you if we "have issues with it", here it goes: I don't think it would be a great idea to move tkinter from the core to a third party library because once that happens we can no longer assume that any GUI

Re: python3.0 MySQLdb

2009-01-12 Thread Daniel Fetchinson
> I need something to connect to a database, preferably mysql, that > works in python3.0 please. And your question is? -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: python3.0 MySQLdb

2009-01-13 Thread Daniel Fetchinson
I need something to connect to a database, preferably mysql, that works in python3.0 please. >>> And your question is? >>> >>> >> Surely it's fairly obvious that the question is "does such a thing >> exist, and if so where can I find it?". > > Interestingly enough, the question was slight

Re: python3.0 MySQLdb

2009-01-14 Thread Daniel Fetchinson
>> >>> I need something to connect to a database, preferably mysql, that >> >>> works in python3.0 please. >> >> And your question is? >> >> > Surely it's fairly obvious that the question is "does such a thing >> > exist, and if so where can I find it?". >> >> Interestingly enough, the question was

Re: python3.0 MySQLdb

2009-01-14 Thread Daniel Fetchinson
> Daniel> Well, this actually is the case: MySql has not been ported. As > Daniel> far as I can see the mysql python module in general (meaning for > Daniel> the 2.x branch) is not as well maintained as some others and > Daniel> questions about windows vs. linux issues periodically

How do I say "two classes up in the inheritance chain" in python?

2009-01-26 Thread Daniel Fetchinson
I have two classes that both inherit from two other classes which both inherit from a single class. The two children have two almost identical methods: class grandparent( object ): def meth( self ): # do something class parent1( grandparent ): def meth( self ): # do someth

Re: How do I say "two classes up in the inheritance chain" in python?

2009-01-27 Thread Daniel Fetchinson
>> I have two classes that both inherit from two other classes which both >> inherit from a single class. The two children have two almost >> identical methods: >> >> class grandparent( object ): >> def meth( self ): >> # do something >> >> class parent1( grandparent ): >> def meth(

Re: "Super()" confusion

2009-02-09 Thread Daniel Fetchinson
>>Hello. I've been scouring the web looking for something to clear up a >>little confusion about the use of "super()" but haven't found anything >>that really helps. Here's my simple example: >> >> [snip] >> >>"super(Child,self).__init__(filePath) >>TypeError: super() argument 1 must be type, not c

Re: "Super()" confusion

2009-02-09 Thread Daniel Fetchinson
Hello. I've been scouring the web looking for something to clear up a little confusion about the use of "super()" but haven't found anything that really helps. Here's my simple example: [snip] "super(Child,self).__init__(filePath) TypeError: super() argument 1 mus

Re: "Super()" confusion

2009-02-10 Thread Daniel Fetchinson
On 2/9/09, Gabriel Genellina wrote: > En Mon, 09 Feb 2009 23:34:05 -0200, Daniel Fetchinson > escribió: > >>>>>> Hello. I've been scouring the web looking for something to clear up a >>>>>> little confusion about the use of "super()"

Re: "Super()" confusion

2009-02-10 Thread Daniel Fetchinson
> Consider whether you really need to use super(). > > http://fuhm.net/super-harmful/ Did you actually read that article, understood it, went through the tons of responses from python-dev team members, including Guido > > "Tons" of responses? This was mentioned already, bu

Re: "Super()" confusion

2009-02-10 Thread Daniel Fetchinson
>>> Consider whether you really need to use super(). >>> http://fuhm.net/super-harmful/ Because throwing around that link carries about the same amount of information as "perl is better than python", "my IDE is better than yours", "vim rulez!", "emacs is cooler than vim"

Re: Easier to wrap C or C++ libraries?

2009-02-13 Thread Daniel Fetchinson
> When creating a Python binding to a C or C++ library, which is easier > to wrap, the C lib or the C++ one? Given a choice, if you had to > choose between using one of two libs, one written in C, the other in C+ > + -- both having approximately the same functionality -- which would > you rather de

Re: RELEASED Python 3.0 final

2008-12-03 Thread Daniel Fetchinson
> On behalf of the Python development team and the Python community, I > am happy to announce the release of Python 3.0 final. > > Python 3.0 (a.k.a. "Python 3000" or "Py3k") represents a major > milestone in Python's history, and was nearly three years in the > making. This is a new version of th

Re: RELEASED Python 3.0 final

2008-12-03 Thread Daniel Fetchinson
>>> On behalf of the Python development team and the Python community, I >>> am happy to announce the release of Python 3.0 final. >>> >>> Python 3.0 (a.k.a. "Python 3000" or "Py3k") represents a major >>> milestone in Python's history, and was nearly three years in the >>> making. This is a new v

Re: RELEASED Python 3.0 final

2008-12-04 Thread Daniel Fetchinson
>> As you have probably guessed: nothing changed here. >> Also see:http://www.python.org/dev/peps/pep-0666/ > > What? Do you mean it's possible to mix tabs and spaces still? Why? Why not? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/

Guido's new method definition idea

2008-12-05 Thread Daniel Fetchinson
Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a possibility since it maintain

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
>> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself acknowledged that an alternative syntax makes perfect sense >> and having both (old and new) in a future version of python is a >> possibili

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
> Bad idea having two ways to do this. Pick one or the other! Maybe only this alternative syntax for python 4000? -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
>> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself acknowledged that an alternative syntax makes perfect sense >> and having both (old and new) in a future version of python is a >> possibili

Re: Guido's new method definition idea

2008-12-07 Thread Daniel Fetchinson
>>> Hi folks, >>> >>> The story of the explicit self in method definitions has been >>> discussed to death and we all know it will stay. However, Guido >>> himself acknowledged that an alternative syntax makes perfect sense >>> and having both (old and new) in a future version of python is a >>> po

Re: Guido's new method definition idea

2008-12-07 Thread Daniel Fetchinson
The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a possibility sin

html codes

2008-12-08 Thread Daniel Fetchinson
Hi folks, I came across a javascript library that returns all sorts of html codes in the cookies it sets and I need my web framework (written in python :)) to decode them. I'm aware of htmlentitydefs but htmlentitydefs.entitydefs.keys( ) are of the form '&#xxx' but this javascript library uses stu

Re: html codes

2008-12-09 Thread Daniel Fetchinson
>> I came across a javascript library that returns all sorts of html >> codes in the cookies it sets and I need my web framework (written in >> python :)) to decode them. I'm aware of htmlentitydefs but >> htmlentitydefs.entitydefs.keys( ) are of the form '&#xxx' but this >> javascript library uses

Re: looking up function's doc in emacs

2008-12-10 Thread Daniel Fetchinson
> in programing elisp in emacs, i can press "Ctrl+h f" to lookup the doc > for the function under cursor. > > is there such facility when coding in perl, python, php? > > (i'm interested in particular python. In perl, i can work around with > "perldoc -f functionName", and in php it's php.net/funct

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Daniel Fetchinson
On 12/10/08, Jon Harrop <[EMAIL PROTECTED]> wrote: > Xah Lee wrote: >> Kaz Kylheku wrote: >>> Really? ``50 or hundreds'' of lines in C? >>> >>> #include /* for sqrt */ >>> >>> void normalize(double *out, double *in) >>> { >>> double denom = sqrt(in[0] * in[0] + in[1] * in[1] + in[2]

why doesn't pop/clear call __delitem__ on a dict?

2008-12-10 Thread Daniel Fetchinson
I just found out that if I want to have a custom dict it's not enough to overload __getitem__, __setitem__ and __delitem__ because, for example, pop and clear don't call __delitem__. I.e. an instance of the following will not print 'deleted' upon instance.pop( 'key' ): class mydict( dict ): de

Re: why doesn't pop/clear call __delitem__ on a dict?

2008-12-11 Thread Daniel Fetchinson
>> I just found out that if I want to have a custom dict it's not enough >> to overload __getitem__, __setitem__ and __delitem__ because, for >> example, pop and clear don't call __delitem__. I.e. an instance of the >> following will not print 'deleted' upon instance.pop( 'key' ): >> >> class mydic

1 or 1/0 doesn't raise an exception

2008-12-13 Thread Daniel Fetchinson
Is it a feature that 1 or 1/0 returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale? -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: 1 or 1/0 doesn't raise an exception

2008-12-13 Thread Daniel Fetchinson
>> Is it a feature that >> >> 1 or 1/0 >> >> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the >> rationale? > > Yes, it's a feature: > > http://en.wikipedia.org/wiki/Short-circuit_evaluation > > When you have "True or False", you know it's true by the time > you've got the first p

Re: something else instead of PIL?

2008-12-17 Thread Daniel Fetchinson
>> what has happened to PIL? No updates since two years. > > The Python Imaging Library is still current; I guess they just haven't > found any new bugs or seen fit to add new functionality in a while, > though I presume they'll start working on a Python 3.0 port > eventually. That's actually an i

PIL on 3.x?

2008-12-19 Thread Daniel Fetchinson
Does anyone know if PIL will be ported to the 3.x branch? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: mod_python resources

2008-12-19 Thread Daniel Fetchinson
> Here's my problem (it's a conceptual one). Coming from the world of > mod_php, each file can represent a page with no intervention. I was > not able to achieve the same with mod_python when I tried, and for > that matter, couldn't put the pieces together in a usable way. > > Let me start simply:

Re: PIL on 3.x?

2008-12-20 Thread Daniel Fetchinson
>> Does anyone know if PIL will be ported to the 3.x branch? > > Have you considered e-mail to the author? No, I haven't because in my experience open source software authors prefer to keep discussion of their software on mailing lists, forums, etc, where others can benefit from the answers too.

Re: Are Django/Turbogears too specific?

2008-12-22 Thread Daniel Fetchinson
> I'd like to rewrite a Web 2.0 PHP application in Python with AJAX, and > it seems like Django and Turbogears are the frameworks that have the > most momentum. > > I'd like to use this opportunity to lower the load on servers, as the > PHP application wasn't built to fit the number of users hammer

Re: Easy-to-use Python GUI

2008-12-24 Thread Daniel Fetchinson
> Is there an easy-to-use, "function"-based cross-platform GUI toolkit for > Python out there that's a little more sophisticated than EasyGui? EasyGui > looks good, but it's a little more restrictive than what I'd like to have, > yet > I'm (stubbornly :-) ) resistant to stepping up to a "full serv

C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
I'm trying to write an extension module in C which contains a single function with the following prototype: void func( int N, int * arg1, int * arg2, int * ret ); Here arg1 and arg2 are length N arrays, and the function computes ret which is also an N length array. From python I'd like to call th

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I'm trying to write an extension module in C which contains a single >> function with the following prototype: >> void func( int N, int * arg1, int * arg2, int * ret ); >> Here arg1 and arg2 are length N arrays, and the function computes ret >> which is also an N length array. From python I'

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I have considered using ctypes but for my needs using the C API >> directly seems more reasonable. array.array and numpy.array doesn't >> fit my needs since I need to do long and complicated operations on the >> two (pretty large) integer arrays that would be too slow using >> array.array and nu

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> I agree that array.array is more efficient than a list but the input >> for my function will come from PIL and PIL returns a list. So I have a >> list to begin with which will be passed to the C function. > > With recent versions of PIL, numpy can create an array from an Image very > quickly, po

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
On 12/27/08, Robert Kern wrote: > Daniel Fetchinson wrote: > >> I agree that array.array is more efficient than a list but the input >> for my function will come from PIL and PIL returns a list. So I have a >> list to begin with which will be passed to the C function. >

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> This is the function I have, the corresponding python function will >> take two equal length lists of integers and the C function will >> compute their sum and return the result as a python tuple. >> >> >> static PyObject *func( PyObject * self, PyObject * args ) >> { >> int j, N; >> int

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
I agree that array.array is more efficient than a list but the input for my function will come from PIL and PIL returns a list. So I have a list to begin with which will be passed to the C function. >>> With recent versions of PIL, numpy can create an array from an Image very >>> qui

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>> This is the function I have, the corresponding python function will >> take two equal length lists of integers and the C function will >> compute their sum and return the result as a python tuple. >> >> >> static PyObject *func( PyObject * self, PyObject * args ) >> { >> int j, N; >> int

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>>> You MUST check EVERY function call for errors! >> >> Yes, I know :) >> > > Believe me, if you don't, there is a risk of crashing the program. And > they're a lot harder to find and fix. Sure, what I meant by the smiley is just that it was a quick and dirty example, not real code. In a real cod

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Daniel Fetchinson
>>> As others already said, using a Numpy array or an array.array object >>> would >>> be more efficient (and even easier - the C code gets a pointer to an >>> array >>> of integers, as usual). >> >> I looked for this in the C API docs but couldn't find anything on how >> to make an array.array pyt

Re: PIL on 3.x?

2008-12-31 Thread Daniel Fetchinson
> Does anyone know if PIL will be ported to the 3.x branch? Actually, Guilherme Polo has ported PIL 1.1.6 to python 3.0: http://mail.python.org/pipermail/image-sig/2008-December/005338.html Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.or

Re: How to Implement an XMLRPC Server in Python?

2008-10-29 Thread Daniel Fetchinson
On 10/29/08, Zix <[EMAIL PROTECTED]> wrote: > Hello, > I am a newbie to python and trying to get a hang of some of its > advanced features through an application I am building. Basically, I'd > like to build a weather forecasting web service. The clients should be > able to query the service with a

Re: What's your choice when handle complicated C structures.

2008-11-04 Thread Daniel Fetchinson
> Recently I am writing a small network application with python. > > The protocol is binary based and defined in c header files. > > Now I'm using the upack function of 'struct' module, but it's really > annoying to write fmt strings for complicated structures. > > What will be your choice when han

Re: Django or TurboGears or Pylons? for python web framework.

2008-11-07 Thread Daniel Fetchinson
> Hi Senior, > > There was a case for web site that will be public to Internet for me. I like > python so I do not consider the use of Ruby on Rails. > > I searched more web framework of python from Google. The good solution just > only there are Django, TurboGears and Pylons. > > Just from my pref

Re: Python-URL! - weekly Python news and links (Nov 17)

2008-11-19 Thread Daniel Fetchinson
>> > One of the reasons I would like to formulate a good >> > model of an object's value and type is so that I could >> > try to offer something better. Responses like yours >> > are significantly demotivating. >> >> And yet you argue when people try to explain to you that objects don't >> *have*

Re: ANN: Dao, the official 1.0 version is released

2009-03-06 Thread Daniel Fetchinson
>> This is to announce the first official release of Dao. >> >> Dao is a simple yet powerful object-oriented programming language > > So, you pimp your language in news groups for other languages? I see > your off topic post in 3 language groups I frequent, that's not the way > to get interest in

Re: ANN: Dao, the official 1.0 version is released

2009-03-06 Thread Daniel Fetchinson
This is to announce the first official release of Dao. Dao is a simple yet powerful object-oriented programming language >>> So, you pimp your language in news groups for other languages? I see >>> your off topic post in 3 language groups I frequent, that's not the way >>> to get in

Re: ANN: Dao, the official 1.0 version is released

2009-03-06 Thread Daniel Fetchinson
>> Why this hostility? The guy has worked on an interesting piece of >> software and tries to promote it to people who are most probably >> interested in programming languages. What's wrong with that? > > Because there's no particular reason for it to be in a Python-specific > forum. Yes there is,

Why is lambda allowed as a key in a dict?

2009-03-09 Thread Daniel Fetchinson
Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x = { } >>> x[lambda arg: arg] = 5 >>> x[lambda arg: arg] Traceback (most recent call last): File "", line 1, in KeyError:

Re: Why is lambda allowed as a key in a dict?

2009-03-09 Thread Daniel Fetchinson
On 3/9/09, bearophileh...@lycos.com wrote: > See here Daniel Fetchinson: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/a973de8f3562675c > > But be quite careful in using that stuff, it has some traps. Thanks a lot for all the helpful replies! Yes, I

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Daniel Fetchinson
> obviously total mewbiew: > > My first program in Python Windows > > print "Hello World" > > I select Run/Run Module and get an error: > > Syntax error, with the closing quote highlighted. > > Tried with single quotes as well. Same problem. > > Can someone explain my mistake? Are you using python

Re: unbiased benchmark

2009-03-12 Thread Daniel Fetchinson
> Dear sir, > > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py

Re: Get pixel colors from images in Python 3

2009-03-13 Thread Daniel Fetchinson
> I've noticed that Pygame has some similar implementation. > It's a little harder to use, but efficient. > > And i think it depends on PIL too. > And Pygame is Python 2.x too... > > So, not good. I'd also like to use PIL with python 3 and was told that PIL's author mostly frequents the image-sig

Re: Disable automatic interning

2009-03-18 Thread Daniel Fetchinson
>> > Is there a way to turn off (either globally or explicitly per >> > instance) the automatic interning optimization that happens for small >> > integers and strings (and perhaps other types) ? I tried several >> > workarounds but nothing worked: >> >> No. It's an implementation detail. >> >> Wh

Re: Disable automatic interning

2009-03-18 Thread Daniel Fetchinson
>> > I'm working on some graph generation problem where the node identity >> > is significant (e.g. "if node1 is node2: # do something) but ideally I >> > wouldn't want to impose any constraint on what a node is (i.e. require >> > a base Node class). It's not a show stopper, but it would be >> > pr

Re: How complex is complex?

2009-03-18 Thread Daniel Fetchinson
> When we say readability counts over complexity, how do we define what > level of complexity is ok? > For example: > Say I have dict a = {'a': 2, 'c': 4, 'b': 3} > I want to increment the values by 1 for all keys in the dictionary. > So, should we do: for key in a: > ... a[key] = a[key] + 1

Re: How complex is complex?

2009-03-19 Thread Daniel Fetchinson
>> > I understand that my question was foolish, even for a newbie. >> > I will not ask any more such questions in the future. >> >> Gaaah! Your question was just fine, a good question on coding style. >> I wish more people would ask such questions so that bad habits could >> be avoided. >> >> The n

Re: Organize large DNA txt files

2009-03-20 Thread Daniel Fetchinson
> I'm using Python scripts too organize some rather large datasets > describing DNA variation. Information is read, processed and written > too a file in a sequential order, like this > 1+ > 1- > 2+ > 2- > > etc.. The files that i created contain positional information > (nucleotide position) and s

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
> It's GSoC time again, and I've had lots of interested students asking about > doing on project on improving 2to3. What kinds of improvements and features > would you like to see in it which student programmers could accomplish? Last time I used 2to3 (maybe not the latest version) it didn't know

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
>> > It's GSoC time again, and I've had lots of interested students asking >> about >> > doing on project on improving 2to3. What kinds of improvements and >> features >> > would you like to see in it which student programmers could accomplish? >> >> Last time I used 2to3 (maybe not the latest vers

safely rename a method with a decorator

2009-03-22 Thread Daniel Fetchinson
I'd like to implement a decorator that would rename the method which it decorates. Since it's a tricky thing in general involving all sorts of __magic__ I thought I would ask around first before writing something buggy :) It should work something like this: class myclass( object ): @rename( '

Re: safely rename a method with a decorator

2009-03-22 Thread Daniel Fetchinson
>> I'd like to implement a decorator that would rename the method which >> it decorates. Since it's a tricky thing in general involving all sorts >> of __magic__ I thought I would ask around first before writing >> something buggy :) >> >> It should work something like this: >> >> class myclass( ob

Re: safely rename a method with a decorator

2009-03-22 Thread Daniel Fetchinson
> there was discussion related to this same problem earlier in the week. > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad08eb9eb83a4e61/d1906cbc26e16d15?q=Mangle+function+name+with+decorator%3F > Thanks this was very helpful! >> I'd like to implement a decorator that w

Re: Python 3 consistency proposal

2009-03-24 Thread Daniel Fetchinson
> Rename all built in classes with a capital letter > example Str() Int() Object() Why? > Make () optional for a function definition > class Test: > pass > > def test: > pass Why? > Any chance Guido would approve this :-) In my estimation, the chance that Guido would approve this is le

Re: Any way to use a range as a key in a dictionary?

2009-03-26 Thread Daniel Fetchinson
> I would like to use a dictionary to store byte table information to > decode some binary data. The actual number of entries won't be that > large, at most 10. That leaves the other 65525 entries as 'reserved' > or 'other' but still need to be somehow accounted for when > referenced. > > So there

Re: Python AppStore / Marketplace

2009-03-27 Thread Daniel Fetchinson
> I think Marcel has a point... > > Much can be done and should be done to improve packaging and applications > for python. > > That's why I for one am working on the python package manager project. On > sourceforge. > > It uses the pypi interface to search. > > Actually we haven't made a release y

numpy array sorting weirdness

2009-03-28 Thread Daniel Fetchinson
So far I was working under the assumption that the numpy array implementation can be used as a drop-in replacement for native python lists, i.e. wherever I see a list 'a' and I want to speed up my numerical calculations I just replace it with 'numpy.array( a )' and everything will work just as befo

Re: numpy array sorting weirdness

2009-03-28 Thread Daniel Fetchinson
>> So far I was working under the assumption that the numpy array >> implementation can be used as a drop-in replacement for native python >> lists, i.e. wherever I see a list 'a' and I want to speed up my >> numerical calculations I just replace it with 'numpy.array( a )' and >> everything will wo

Re: numpy array sorting weirdness

2009-03-28 Thread Daniel Fetchinson
>> The fact that the following two outputs are not the same is a bug or a >> feature of numpy? >> >> # I would have thought the two array outputs would be the same ## >> >> import numpy >> >> a = [ [ 0, 0 ], [ 1, 0 ], [ 1, 1 ] ] >> >> pythonarray = a >> pythonarray.sort( ) >> print pythonar

Re: Bullshit Generator

2009-03-29 Thread Daniel Fetchinson
> Hello, > > For those of you that > - want to surf on the edge of Web technology without understanding it, > - desire to be considered as a software guru, > - are forced to write technical documents that nobody will read. > - want to laugh a bit, > > I have written a "Bullshit Generator" script in

Re: numpy array sorting weirdness

2009-03-29 Thread Daniel Fetchinson
>> Is there any reason the 'axis' keyword argument doesn't default to the >> value that corresponds to python list behaviour? That would make lot >> of sense I think. Or retaining compatibility with python lists is not >> really a goal of numpy.array? > > Not at all. It's an entirely different data

2.5/2.4 multiprocessing backport doc typo

2009-03-29 Thread Daniel Fetchinson
Whoever wrote the multiprocessing backport for 2.4/2.5, a big thank you! Just one note: on the page http://pypi.python.org/pypi/multiprocessing/ there is a news item from the future: === Changes === 2.6.1.1 -- 2009-12-07 I guess it should be 2008-12-07 :) Cheers, Daniel -- Ps

Re: Python AppStore / Marketplace

2009-03-29 Thread Daniel Fetchinson
>> How will your solution be different from distutils, setuptools, pip, >> zc.buildout and a couple other similar packages I don't recall now? > > For a start.. it doesn't replace those.. it drives them... > >> Have you considered joining one of these efforts in order to not >> fragment the "packag

Re: methods and class methods

2009-03-31 Thread Daniel Fetchinson
> I just learned python programming and is wondering how to change a method to > a class method. class x( object ): @classmethod i_will_be_a_class_method( cls ): pass > Also what are the differences between a method and class method. A class method receives the class as its first argumen

Re: HTML Generation

2009-04-03 Thread Daniel Fetchinson
> Hello all, > > I'm writing a web app and wanted to do some html generation (I really do not > like to maintain or write html). > > I'm thinking of writing a dsl based on the following: > > def html(): > return > > def a(): > return > > def body(): > return > (html, > ...(head, (style,

Re: Best Compatible JS Lib for Django

2009-04-04 Thread Daniel Fetchinson
> Does anyone have experience with using JS Libraries with Django? > Do some work better than others and are easier to code with? You might want to ask this on the django list. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/lis

decorator module in stdlib?

2009-04-06 Thread Daniel Fetchinson
The decorator module [1] written by Michele Simionato is a very useful tool for maintaining function signatures while applying a decorator. Many different projects implement their own versions of the same functionality, for example turbogears has its own utility for this, I guess others do somethin

Re: decorator module in stdlib?

2009-04-06 Thread Daniel Fetchinson
>> Similar functionality is already provided by >> functools.update_wrapper() and functools.wraps(). >> Seehttp://docs.python.org/library/functools.html >> You might consider proposing the modification of these functions instead. > > Unfortunately functools.update_wrapper() and functools.wraps() >

Re: Anyone mannaged to access parallel port on windows xp?

2009-04-07 Thread Daniel Fetchinson
> I have a switch that I should connect to the parallel port, but had no luck > with it. Tha guy that made it for me told me that it would be easyer to > connect via parallel instead the USB > So did anyone have success? I only get suckess!! :-)) > tryed giveio.sys but it doesn't wort (can't f

Re: Recommendations on Pythonic tree data structure design techniques

2009-04-09 Thread Daniel Fetchinson
> Any recommendations on Python based tree data structures that I > can study? I'm working on an application that will model a basic > outline structure (simple tree) and am looking for ideas on > Pythonic implementation techniques. By outline I mean a > traditional hierarchical document outline (s

<    1   2   3   4   5   >