Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
I decided to create a decorator like. import cProfile def debug_time(method): def timed(*args, **kw): prof = cProfile.Profile() prof.enable(subcalls=False, builtins=False) result = prof.runcall(method, *args, **kw) #prof.print_stats() msg = "\n\n\n\n###

ldap proxy user bind

2012-02-10 Thread sajuptpm
I have developed a LDAP auth system using python-ldap module. Using that i can validate username and password, fetch user and groups info from LDAP directory. Now i want to implement ldap proxy user bind to the ldap server. I googled and find this http://ldapwiki.willeke.com/wiki/LDAPProxyUser But

Re: datetime module and timezone

2012-02-10 Thread Bob Martin
in 671891 20120210 212545 Olive wrote: >In the datetime module, it has support for a notion of timezone but is >it possible to use one of the available timezone (I am on Linux). Linux >has a notion of timezone (in my distribution, they are stored >in /usr/share/zoneinfo). I would lik

Re: frozendict

2012-02-10 Thread 88888 Dihedral
在 2012年2月11日星期六UTC+8上午2时57分34秒,John Nagle写道: > On 2/10/2012 10:14 AM, Nathan Rice wrote: > >>> Lets also not forget that knowing an object is immutable lets you do a > >>> lot of optimizations; it can be inlined, it is safe to convert to a > >>> contiguous block of memory and stuff in cache, etc.

Re: problems with shelve(), collections.defaultdict, self

2012-02-10 Thread 7stud
On Feb 10, 7:52 pm, 7stud <7s...@excite.com> wrote: I don't know if this helps, but I notice when I initially do this: shelve.open('data22') the file is saved as 'data22.db'. But on subsequent calls to shelve.open(), if I use the file name 'data22.db', I get a different error: --output:-- **

Re: problems with shelve(), collections.defaultdict, self

2012-02-10 Thread 7stud
On Feb 10, 7:48 pm, 7stud <7s...@excite.com> wrote: > > But I cannot get a class that inherits from collections.defaultdict to > shelve itself: > > import collections as c > import shelve > > class Dog(c.defaultdict): >     def __init__(self): >         super().__init__(int, Joe=0) >         print(

problems with shelve(), collections.defaultdict, self

2012-02-10 Thread 7stud
The following code demonstrates that a collections.defaultdict is shelve worthy: import shelve import collections as c dd = c.defaultdict(int) dd["Joe"] = 3 print(dd) my_shelve = shelve.open('data.shelve') my_shelve['strike_record'] = dd my_shelve.close() my_shelve = shelve.open('data.shelve'

ANN: dbf.py 0.90.001

2012-02-10 Thread Ethan Furman
Still messing with .dbf files? Somebody brought you a 15 year old floppy, which still luckily (?) worked, and now wants that ancient data? dbf to the rescue! Supported tables/features = - dBase III - FoxPro - Visual FoxPro supported - Null value Supported fiel

Re: Postpone evaluation of argument

2012-02-10 Thread Paul Rubin
Righard van Roy writes: > I want to add an item to a list, except if the evaluation of that item > results in an exception. This may be overkill and probably slow, but perhaps most in the spirit that you're asking. from itertools import chain def r(x): if x > 3: rais

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Albert W. Hopkins
On Fri, 2012-02-10 at 14:52 -0800, Paul Rubin wrote: > Fabric Paul writes: > > Hi Stefan - Thanks for the heads up. Fabric Engine has been going for > > about 2 years now. Registered company etc. I'll be sure to refer to it > > as Fabric Engine so there's no confusion. We were unaware there was a

Re: How can I catch misnamed variables?

2012-02-10 Thread Christian Heimes
Am 10.02.2012 22:06, schrieb John Gordon: > Is there an automated way to catch errors like these? I'm using the > compileall module to build my program and it does catch some errors > such as incorrect indentation, but not errors like the above. Write unit tests and use coverage to aim for 100% c

Re: Postpone evaluation of argument

2012-02-10 Thread Chris Rebert
On Fri, Feb 10, 2012 at 3:01 PM, Righard van Roy wrote: > Hello, > > I want to add an item to a list, except if the evaluation of that item > results in an exception. > I could do that like this: > > def r(x): >    if x > 3: >        raise(ValueError) > > try: >    list.append(r(1)) > except: >  

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread John Gordon
In Kev Dwyer writes: > *Any* instrumentation code is going to affect performance. Funny story about that... I wanted to profile some code of mine, and a colleague recommended the 'hotshot' module. It's pretty easy to use: there are functions to start profiling, stop profiling and print resul

Postpone evaluation of argument

2012-02-10 Thread Righard van Roy
Hello, I want to add an item to a list, except if the evaluation of that item results in an exception. I could do that like this: def r(x): if x > 3: raise(ValueError) try: list.append(r(1)) except: pass try: list.append(r(5)) except: pass This looks rather clumbsy t

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Paul Rubin
Fabric Paul writes: > Hi Stefan - Thanks for the heads up. Fabric Engine has been going for > about 2 years now. Registered company etc. I'll be sure to refer to it > as Fabric Engine so there's no confusion. We were unaware there was a > python tool called Fabric. There will still be confusion.

Re: OT (waaaayyyyyyyyy off-topic)

2012-02-10 Thread Ben Finney
Thanks for responding. Rather than take this discussion too far where it's quite off-topic, I'll respond briefly and ask for a change of forum if we want to continue. Ethan Furman writes: > Ben Finney wrote (from signature): > > “It's a terrible paradox that most charities are driven by religi

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Kev Dwyer
sajuptpm wrote: > Hi, > > Yes i saw profile module, > I think i have to do function call via > > cProfile.run('foo()') > > I know, we can debug this way. > > But, i need a fixed logging system and want to use it in production. > I think, we can't permanently include profile's debugging c

Re: Read-only attribute in module

2012-02-10 Thread Terry Reedy
On 2/10/2012 6:11 AM, mloskot wrote: The intent of xyz.flag is that it is a value set by the module internally. xyz is a module wrapping a C library. The C library defines concept of a global flag set by the C functions at some events, so user can check value of this flag. I can provide access t

Re: Read-only attribute in module

2012-02-10 Thread Steven D'Aprano
On Thu, 09 Feb 2012 22:27:50 -0500, Terry Reedy wrote: > On 2/9/2012 8:04 PM, Steven D'Aprano wrote: > >> Python happily violates "consenting adults" all over the place. We have >> properties, which can easily create read-only and write-once >> attributes. > > So propose that propery() work at m

OT (waaaayyyyyyyyy off-topic) [was Re: How can I catch misnamed variables?]

2012-02-10 Thread Ethan Furman
Ben Finney wrote (from signature): > “It's a terrible paradox that most charities are driven by religious > belief. . . . if you think altruism without Jesus is not altruism, > then you're a dick.” —Tim Minchin, 2010-11-28 1) Why is it paradoxical? If anything it's a sad commentary on those who

Re: datetime module and timezone

2012-02-10 Thread Chris Rebert
On Fri, Feb 10, 2012 at 1:25 PM, Olive wrote: > In the datetime module, it has support for a notion of timezone but is > it possible to use one of the available timezone (I am on Linux). Linux > has a notion of timezone (in my distribution, they are stored > in /usr/share/zoneinfo). I would like t

Re: Removing items from a list

2012-02-10 Thread Chris Angelico
On Sat, Feb 11, 2012 at 7:04 AM, Thomas Philips wrote: > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for i in x: >        if i % 2 == 0: >                x.remove(i) Just a quickie, is there a reason you can't use a list comprehension? x = [i for i in x if i % 2] ChrisA -- http://mail.python.org/mailm

Re: datetime module and timezone

2012-02-10 Thread John Gordon
In <20120210222545.4cbe6...@bigfoot.com> Olive writes: > In the datetime module, it has support for a notion of timezone but is > it possible to use one of the available timezone (I am on Linux). Linux > has a notion of timezone (in my distribution, they are stored > in /usr/share/zoneinfo). I wo

Re: How can I catch misnamed variables?

2012-02-10 Thread Ben Finney
John Gordon writes: > Is there an automated way to catch errors like these? Use a static code checker, such as ‘pyflakes’ (simple but limited) or ‘pylint’ (complex but highly configurable) to catch these and many other problems in Python code. -- \ “It's a terrible paradox that most

datetime module and timezone

2012-02-10 Thread Olive
In the datetime module, it has support for a notion of timezone but is it possible to use one of the available timezone (I am on Linux). Linux has a notion of timezone (in my distribution, they are stored in /usr/share/zoneinfo). I would like to be able 1) to know the current timezone and 2) to be

Re: How can I catch misnamed variables?

2012-02-10 Thread Kev Dwyer
John Gordon wrote: > Recently I was been bitten by some stupid errors in my code, and I'm > wondering if there's a simple way to catch them. > Pyflakes is another static checker that can catch these sorts of errors. Cheers, Kev -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I catch misnamed variables?

2012-02-10 Thread Arnaud Delobelle
On 10 February 2012 21:06, John Gordon wrote: > Recently I was been bitten by some stupid errors in my code, and I'm > wondering if there's a simple way to catch them. > > One error was of the form: > >  my_object.some_function() > > .. when I hadn't declared an object named "my_object". > > The o

How can I catch misnamed variables?

2012-02-10 Thread John Gordon
Recently I was been bitten by some stupid errors in my code, and I'm wondering if there's a simple way to catch them. One error was of the form: my_object.some_function() .. when I hadn't declared an object named "my_object". The other error was similar: x = my_module.CONSTANT .. when I h

Re: round down to nearest number

2012-02-10 Thread Olive
On Thu, 9 Feb 2012 17:43:58 -0800 Chris Rebert wrote: > On Thu, Feb 9, 2012 at 5:23 PM, noydb wrote: > > hmmm, okay. > > > > So how would you round UP always?  Say the number is 3219, so you > > want 3300 returned. > > http://stackoverflow.com/questions/17944/how-to-round-up-the-result-of-integ

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 04:00 PM, Peter Otten wrote: Sorry, you didn't mention that in the post I responded to and I didn't follow the thread closely. I found a description for declare_namespace() at http://peak.telecommunity.com/DevCenter/PkgResources but the text explaining the function is completely u

Re: Removing items from a list

2012-02-10 Thread Thomas Philips
Thanks for the insight. I saw the behavious as soon as I extended x with a bunch of 0's >>> x = list(range(10)) >>> x.extend([0]*10) >>> x [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> for i in reversed(x): if i % 2 == 0: x.remove(i) >>> x [1, 3, 5, 7, 9

Re: Removing items from a list

2012-02-10 Thread MRAB
On 10/02/2012 20:04, Thomas Philips wrote: In the past, when deleting items from a list, I looped through the list in reverse to avoid accidentally deleting items I wanted to keep. I tried something different today, and, to my surprise, was able to delete items correctly, regardless of the direct

Re: Forking simplejson

2012-02-10 Thread Amirouche Boubekki
Héllo, I did it, it wasn't that difficult actually. the source is available @ https://github.com/amirouche/jsonir there is example : https://github.com/amirouche/jsonir/blob/master/example.py What makes the implementation of __json__ awkward is the iterencode support of simplejson that I kept.

Re: Removing items from a list

2012-02-10 Thread Ian Kelly
On Fri, Feb 10, 2012 at 1:04 PM, Thomas Philips wrote: > In the past, when deleting items from a list, I looped through the > list in reverse to avoid accidentally deleting items I wanted to keep. > I tried something different today, and, to my surprise, was able to > delete items correctly, regar

Removing items from a list

2012-02-10 Thread Thomas Philips
In the past, when deleting items from a list, I looped through the list in reverse to avoid accidentally deleting items I wanted to keep. I tried something different today, and, to my surprise, was able to delete items correctly, regardless of the direction in which I looped, in both Python 3.2.2.

Re: frozendict

2012-02-10 Thread John Nagle
On 2/10/2012 10:14 AM, Nathan Rice wrote: Lets also not forget that knowing an object is immutable lets you do a lot of optimizations; it can be inlined, it is safe to convert to a contiguous block of memory and stuff in cache, etc. If you know the input to a function is guaranteed to be frozen

Re: frozendict

2012-02-10 Thread Nathan Rice
>> Lets also not forget that knowing an object is immutable lets you do a >> lot of optimizations; it can be inlined, it is safe to convert to a >> contiguous block of memory and stuff in cache, etc.  If you know the >> input to a function is guaranteed to be frozen you can just go crazy. >> Being

Re: round down to nearest number

2012-02-10 Thread noydb
On Feb 10, 4:58 am, Arnaud Delobelle wrote: > On 10 February 2012 06:21, Ian Kelly wrote: > > > > > > > (3219 + 99) // 100 * 100 > >> 3300 > > (3289 + 99) // 100 * 100 > >> 3300 > > (328678 + 99) // 100 * 100 > >> 328700 > > (328 + 99) // 100 * 100 > >> 400 > > >> Those are all ro

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Fabric Paul
On Feb 10, 12:21 pm, Stefan Behnel wrote: > Fabric Paul, 10.02.2012 17:04: > > > Fabric is a high-performance multi-threading engine that > > integrates with dynamic languages. > > Hmm, first of all, fabric is a tool for automating > admin/deployment/whatever tasks: > > http://pypi.python.org/pypi

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Stefan Behnel
Fabric Paul, 10.02.2012 17:04: > Fabric is a high-performance multi-threading engine that > integrates with dynamic languages. Hmm, first of all, fabric is a tool for automating admin/deployment/whatever tasks: http://pypi.python.org/pypi/Fabric/1.3.4 http://docs.fabfile.org/en/1.3.4/index.html

Re: multiple namespaces within a single module?

2012-02-10 Thread jkn
Hi Peter On Feb 10, 11:10 am, Peter Otten <__pete...@web.de> wrote: [...] > > Hmm ... thanks for mentioning this feature, I didn't know of it > > before. Sounds great, except that I gather it needs Python >2.5? I'm > > stuck with v2.4 at the moment unfortunately... > > You can import and run exp

Re: frozendict

2012-02-10 Thread Chris Rebert
On Fri, Feb 10, 2012 at 8:53 AM, Nathan Rice wrote: > Lets also not forget that knowing an object is immutable lets you do a > lot of optimizations; it can be inlined, it is safe to convert to a > contiguous block of memory and stuff in cache, etc.  If you know the > input to a function is guaran

Re: frozendict

2012-02-10 Thread Nathan Rice
On Fri, Feb 10, 2012 at 5:08 AM, Chris Angelico wrote: > On Fri, Feb 10, 2012 at 1:30 PM, Nathan Rice > wrote: >> The only thing needed to avoid the hash collision is that your hash >> function is not not 100% predictable just by looking at the python >> source code.  I don't see why every dict w

Fabric Engine + Python benchmarks

2012-02-10 Thread Fabric Paul
Hi all - just letting you know that we recently integrated Fabric with Python. Fabric is a high-performance multi-threading engine that integrates with dynamic languages. We're releasing soon (probably under AGPL), and we just released these benchmarks. http://fabric-engine.com/2012/02/fabric-engi

Re: changing sys.path

2012-02-10 Thread Peter Otten
Andrea Crotti wrote: > On 02/10/2012 03:27 PM, Peter Otten wrote: >> The package a will be either a.c/a/ or a.b/a/ depending on whether >> a.c/ or a.b/ appears first in sys.path. If it's a.c/a, that does not >> contain a c submodule or subpackage. > > > I would agree if I didn't have this declar

Re: changing sys.path

2012-02-10 Thread Peter Otten
Peter Otten wrote: > If it's a.c/a, that does not contain a c submodule or subpackage. Sorry, I meant a.b/a -- http://mail.python.org/mailman/listinfo/python-list

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 03:27 PM, Peter Otten wrote: The package a will be either a.c/a/ or a.b/a/ depending on whether a.c/ or a.b/ appears first in sys.path. If it's a.c/a, that does not contain a c submodule or subpackage. I would agree if I didn't have this declaration __import__('pkg_resources').

Re: changing sys.path

2012-02-10 Thread Peter Otten
Andrea Crotti wrote: > Ok now it's getting really confusing, I tried a small example to see > what is the real behaviour, > so I created some package namespaces (where the __init__.py declare the > namespace package). > >/home/andrea/test_ns: >total used in directory 12 available 5655372

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 03:06 PM, Dave Angel wrote: Yes, you've got periods in your directory names. A period means something special within python, and specifically within the import. When you say from a.c import api You're telling it:from package a get module c, and from there impoort the sy

Re: changing sys.path

2012-02-10 Thread Dave Angel
On 02/10/2012 09:51 AM, Andrea Crotti wrote: Ok now it's getting really confusing, I tried a small example to see what is the real behaviour, so I created some package namespaces (where the __init__.py declare the namespace package). /home/andrea/test_ns: total used in directory 12 available 565

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
Ok now it's getting really confusing, I tried a small example to see what is the real behaviour, so I created some package namespaces (where the __init__.py declare the namespace package). /home/andrea/test_ns: total used in directory 12 available 5655372 drwxr-xr-x 3 andrea andrea 4096 F

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Mark Lawrence
Please don't top post. On 10/02/2012 12:59, Saju M wrote: Yes i saw profile module, I think, i have to do function call via cProfile.run('foo()') I know, we can debug this way. But, I need a fixed logging system and want to use it in production. I think, we can't permanently include profi

Re: changing sys.path

2012-02-10 Thread Dave Angel
On 02/10/2012 08:08 AM, Andrea Crotti wrote: I think I finally located the issue with the sys.path extension. The problem is that I have many namespace directories, for example lib: - sub1 - sub2 lib: - sub3 - sub4 But to have everything working I had lib.sub3 in easy-install.pth. Now i

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
I think I finally located the issue with the sys.path extension. The problem is that I have many namespace directories, for example lib: - sub1 - sub2 lib: - sub3 - sub4 But to have everything working I had lib.sub3 in easy-install.pth. Now if I try to add something else to the path it d

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
Hi, Yes i saw profile module, I think i have to do function call via cProfile.run('foo()') I know, we can debug this way. But, i need a fixed logging system and want to use it in production. I think, we can't permanently include profile's debugging code in source code, will cause any

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Saju M
Yes i saw profile module, I think, i have to do function call via cProfile.run('foo()') I know, we can debug this way. But, I need a fixed logging system and want to use it in production. I think, we can't permanently include profile's debugging code in source code, will cause any perfor

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Saju M
On Fri, Feb 10, 2012 at 6:12 PM, Saju M wrote: > Hi, > > Yes i saw profile module, > I think i have to do function call via > > cProfile.run('foo()') > > I know, we can debug this way. > > But i need a fixed logging system .. > > > > On Fri, Feb 10, 2012 at 6:08 PM, Arnaud Delobelle wrote: > >> O

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Saju M
Hi, Yes i saw profile module, I think i have to do function call via cProfile.run('foo()') I know, we can debug this way. But i need a fixed logging system .. On Fri, Feb 10, 2012 at 6:08 PM, Arnaud Delobelle wrote: > On 10 February 2012 12:30, sajuptpm wrote: > > Hi, > > > > I want to lo

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread Arnaud Delobelle
On 10 February 2012 12:30, sajuptpm wrote: > Hi, > > I want to log time taken to complete database requests inside a method/ > function using decorator .  is it possible > I think, i have to inject log code inside the method/fuctions or > modify it. > I wrote a decorator to log taken by a met

log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
Hi, I want to log time taken to complete database requests inside a method/ function using decorator . is it possible I think, i have to inject log code inside the method/fuctions or modify it. I wrote a decorator to log taken by a method/function to complete it execution and its working wel

Re: Read-only attribute in module

2012-02-10 Thread mloskot
Terry Reedy wrote > > On 2/9/2012 6:43 AM, Mateusz Loskot wrote: >> import xyz print(xyz.flag) # OK >> xyz.flag = 0 # error due to no write access > > Why prevent that? If you called it 'FLAG', that would indicate that it > is a constant that should not be changed. While Python make some effor

Re: multiple namespaces within a single module?

2012-02-10 Thread Peter Otten
jkn wrote: > Hi Peter > > On Feb 9, 7:33 pm, Peter Otten <__pete...@web.de> wrote: >> jkn wrote: >> > is it possible to have multiple namespaces within a single python >> > module? >> >> Unless you are abusing classes I don't think so. >> >> > I have a small app which is in three or four .py file

Re: round down to nearest number

2012-02-10 Thread Alec Taylor
o.O Very nice On Fri, Feb 10, 2012 at 8:58 PM, Arnaud Delobelle wrote: > On 10 February 2012 06:21, Ian Kelly wrote: >> (3219 + 99) // 100 * 100 >>> 3300 >> (3289 + 99) // 100 * 100 >>> 3300 >> (328678 + 99) // 100 * 100 >>> 328700 >> (328 + 99) // 100 * 100 >>> 400 >>> >>> Thos

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

2012-02-10 Thread Arnaud Delobelle
On 8 February 2012 01:48, Lei Cheng wrote: > Hi all, > >    In a py file, when to use import statements in the header, when to use > import statements in the blocks where they are used? >    What are the best practices? >    Thanks! Aside from other answers: in some rare cases, importing within a

Re: multiple namespaces within a single module?

2012-02-10 Thread Arnaud Delobelle
On 10 February 2012 00:05, Ethan Furman wrote: > Ethan Furman wrote: >> >> Hrm -- and functions/classes/etc would have to refer to each other that >> way as well inside the namespace... not sure I'm in love with that... > > > > Not sure I hate it, either.  ;) > > Slightly more sophisticated code:

Re: Any idea for build code bars???

2012-02-10 Thread Mark Lawrence
On 10/02/2012 10:10, sisifus wrote: Hello all, I new in python but i want to practice very much. In interesting in build an application which read a text file, translate the information in 128 bar code format and print all the information in a printer. File text content: 123456 123456 Where e

Re: Read-only attribute in module

2012-02-10 Thread Arnaud Delobelle
On 10 February 2012 03:27, Terry Reedy wrote: > On 2/9/2012 8:04 PM, Steven D'Aprano wrote: > >> Python happily violates "consenting adults" all over the place. We have >> properties, which can easily create read-only and write-once attributes. > > > So propose that propery() work at module level,

Any idea for build code bars???

2012-02-10 Thread sisifus
Hello all, I new in python but i want to practice very much. In interesting in build an application which read a text file, translate the information in 128 bar code format and print all the information in a printer. File text content: 123456 123456 Where each line mean: 1º --> Print in text fo

Re: frozendict

2012-02-10 Thread Chris Angelico
On Fri, Feb 10, 2012 at 1:30 PM, Nathan Rice wrote: > The only thing needed to avoid the hash collision is that your hash > function is not not 100% predictable just by looking at the python > source code.  I don't see why every dict would have to be created > differently.  I would think having th

Re: round down to nearest number

2012-02-10 Thread Arnaud Delobelle
On 10 February 2012 06:21, Ian Kelly wrote: > (3219 + 99) // 100 * 100 >> 3300 > (3289 + 99) // 100 * 100 >> 3300 > (328678 + 99) // 100 * 100 >> 328700 > (328 + 99) // 100 * 100 >> 400 >> >> Those are all rounded up to the nearest 100 correctly. > > One thing to be aware of though

Re: Guide to: Learning Python Decorators

2012-02-10 Thread 88888 Dihedral
I prefer to decorate a function not a method. I prefer to decorate an object to own a new method from the existed ones inherited in all the class levels. I do not decorate a class if not necessary. I believe this is more pythonic to add functionalities to objects in classes by aggregated

Re: Common LISP-style closures with Python

2012-02-10 Thread 88888 Dihedral
在 2012年2月4日星期六UTC+8上午8时27分56秒,Antti J Ylikoski写道: > In Python textbooks that I have read, it is usually not mentioned that > we can very easily program Common LISP-style closures with Python. It > is done as follows: > > - > > # Make a Common LISP-like closure

Re: ANN: eGenix mxODBC Zope Database Adapter 2.0.2

2012-02-10 Thread anon hung
Thanks a bunch for the whole team! Best, anonhung On 2/9/12, eGenix Team: M.-A. Lemburg wrote: > > ANNOUNCEMENT > > mxODBC Zope Database Adapter > > Version 2.0.2 > >

Re: what is the difference between @property and method

2012-02-10 Thread Zheng Li
Thank you On 2012/02/10, at 0:36, John Posner wrote: > On 2:59 PM, Devin Jeanpierre wrote: > > >> It is kind of funny that the docs don't ever explicitly say what a >> property is. http://docs.python.org/library/functions.html#property -- >> Devin > > Here's a writeup that does: > http://wiki