Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
BTW, what it your use case? I have yet to see a single compelling use case for multiple inheritance, so I am curious of what your design is. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
s, annoyances. Whereas I recommend the first lecture about iterators and generators to everybody, take in account than the second and especially the third lecture may cause your head to explode. I do not take any responsability in that case. """ Michele

Re: empty lists vs empty generators

2005-05-02 Thread Michele Simionato
iterables too. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Use case for multiple inheritance (was Re: MRO problems with diamond inheritance?)

2005-05-02 Thread Michele Simionato
ad and written MI hierarchies that could have much better written without MI. Finally, let me say that cooperative methods are terrible for maintenance. Nowadays, I tend to use MI just for debugging (yes, a mixing is convenient, if not compelling, for adding debugging functionality to a class). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Documenting Python code.

2005-05-03 Thread Michele Simionato
I would say reStructuredText is the preferred format for documenting Python code. Google is your friend. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: empty lists vs empty generators

2005-05-03 Thread Michele Simionato
opy of the original one >>> it1.next() 1 In general you can use the idiom it = check(it) # check for emptiness if it: # do something This time I have checked the examples here with my doctester http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410052 ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding new methods to new-style classes dynamically

2005-05-05 Thread Michele Simionato
Do you mean setattr? setattr(A, meth_name, lambda self: type(self)) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: A Module on Time & Date

2005-05-10 Thread Michele Simionato
You should read the documentation and this: http://www.catb.org/~esr/faqs/smart-questions.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: object oriented inheritance problem

2005-05-10 Thread Michele Simionato
-style classes and more). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

decorator module

2005-05-16 Thread Michele Simionato
find it here: http://www.phyast.pitt.edu/~micheles/python/decorator.zip It is released under the Python licence. Let me know if you are using it and if you would like further additions/improvements/changes/etc. Feeback is welcome! Michele Simionato -- http://mail.python.org

Re: Quick Reference from module doc strings.

2005-05-17 Thread Michele Simionato
nks to the original source code, so I can see it with a click. I can feed to "minidoc" whole packages (it works recursively on subpackages, so everything is documented). It was unvaluable in my struggle with Zope. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick Reference from module doc strings.

2005-05-17 Thread Michele Simionato
an reach the documentation for that name with a click. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick Reference from module doc strings.

2005-05-17 Thread Michele Simionato
on >Ps... I like your physics link page. :) That page is old, I am no more in physics, but I still have that account for free and I am lazy, so I am keeping it ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick Reference from module doc strings.

2005-05-17 Thread Michele Simionato
These days I use generators instead of StringIO, i.e. instead of print >> out, mystring I just write yield mystring and then I "".join the generator. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: super() and automatic method combination

2005-05-18 Thread Michele Simionato
b.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip You can also define a custom super that does not give an error when the superclass doesn't have the corresponding method (I posted an example some time ago to somebody complaining for the same reason). Michele Sim

self-promotion of the decorator module (Was: How to learn OO of python?)

2005-05-18 Thread Michele Simionato
are preserved; 3. the signature of the original function is preserved (this one is nontrivial). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
for testing border cases I would have never imagined! Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
ans of an assert statement? Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
... Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: self-promotion of the decorator module

2005-05-19 Thread Michele Simionato
Yep, I was wondering about irrelevant things, there is no problem in this case, actually. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: A newbie metaclass question

2005-05-22 Thread Michele Simionato
ary/l-pymeta2/index.html http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__() not called automatically

2005-05-26 Thread Michele Simionato
If you really want, you can customize the object system to automatically call __init__, via a custom metaclass. There is an example in my ACCU lectures (cooperative_init.py): http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip Michele Simionato -- http

scripting browsers from Python

2005-05-31 Thread Michele Simionato
ended with my application. Any suggestion? Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: scripting browsers from Python

2005-06-01 Thread Michele Simionato
This looks interesting, but I need an example here. What would be the command to open Konqueror to a given page and to post a form with given parameters? kde.org has tons a material, but I am getting lost and I don't find anything relevant to my simple problem. Mi

Re: Function Serialization

2005-06-01 Thread Michele Simionato
n [4]: sh["f"]=f In [5]: sh.close() In [6]: sh=shelve.open("x.shelve") In [7]: sh["f"] Out[7]: You may want to experiment a bit. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: metaclass that inherits a class of that metaclass?

2005-06-03 Thread Michele Simionato
You should read the metaclass book, if you can find it. For the reference, see http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html http://www-128.ibm.com/developerworks/linux/library/l-pymeta2/index.html Michele Simionato -- http://mail.python.org/mailman

Re: Destructive Windows Script

2005-06-06 Thread Michele Simionato
BTW, since this is a bit off-topic anyway, how do I recover files accidentally removed? Is there a free tool that works on FAT/NTFS and ext2/ext3? Thanks, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Destructive Windows Script

2005-06-06 Thread Michele Simionato
The problem is that Google gives me too many non-relevant hits. I just would like something like this: $ rm what-I-think-is-an-useless-file ACK! It was not that useless!! $ recover what-I-think-is-an-useless-file Michele Simionato -- http://mail.python.org/mailman/listinfo

Re: Abstract and concrete syntax

2005-06-09 Thread Michele Simionato
>From a purist perspective the distinction statements/expressions is a mistake. However, if your primary concerns is readability, it makes sense, since it enforces ifs, try.. excepts, etc. to be consistently written for all coders. This definitely helps code review. Michele Simion

Re: multiple inheritance

2005-06-09 Thread Michele Simionato
If you are curious, the MRO algorithm is explained here: http://www.python.org/2.3/mro.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating HTML from python

2005-06-09 Thread Michele Simionato
You could generate your report in reStructuredText format (Google is your friend) and then convert them in HTML, PS, PDF, etc. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Michele Simionato
d): makedirs(head, mode) if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists return mkdir(name, mode) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-14 Thread Michele Simionato
*we* >are building the world. This is a huge fundamental difference! It looks like you do not have a background in Physics research. We *do* build the world! ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ? (OT I guess)

2005-06-14 Thread Michele Simionato
Magnus Lycka: > While scientists do build and create things, > the ultimate goal of science is understanding. Scientists build > so that they can learn. Programmers and engineers learn so that > they can build. Well put! I am going to add this to my list of citations :)

Re: What is different with Python ?

2005-06-14 Thread Michele Simionato
ys distinguish between Science (=what we know) and Research (=what we do not know). Research is performed with all methods except the scientific one, even if we don't tell the others ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic

2005-06-15 Thread Michele Simionato
t;a") print Foo("b") Michele Simionato P.S. don't do it! -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic

2005-06-15 Thread Michele Simionato
sometimes TIFFReader instances. Explicit is better than implicit and all that. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic

2005-06-15 Thread Michele Simionato
. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-17 Thread Michele Simionato
ramming; on the other hand, I think that even now there is a 1% of people extremely interested in turning on or off a pixel. I don't think anything significant changed in the percentages. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-17 Thread Michele Simionato
don't see the connection. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-17 Thread Michele Simionato
rom my >overall experience I infer, that it is not only possible >but has sometimes even better chances for success, >because one is not overloaded with the ballast of deep >understanding which can not only be useful but also >hinder from fast progress. FWIW, this is also my experience.

Re: What is different with Python ?

2005-06-17 Thread Michele Simionato
h a shallow knowledge is a useful skill ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-18 Thread Michele Simionato
Your position reminds me of this: http://www.pbm.com/~lindahl/real.programmers.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python rocks

2007-06-04 Thread Michele Simionato
ere removed, Python would have closures still) and it is shows idioms which are now deprecated or that have better alternative using list or generator-expressions, generators, and the itertools module. So my advice is to forget about that link and to read the standard library more ;) Michel

Re: Basic Auth for simple web server

2007-06-05 Thread Michele Simionato
passwd = 'bar' auth_app = AuthBasicHandler( myapp, 'app realm', only_for_foo) (where myapp is your WSGI application, of course). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: web development without using frameworks

2007-06-05 Thread Michele Simionato
ard time coming up with resources and > > examples for this. Does anyone have anything that could be helpful? > > I'd say the only decent ways are either using a full-featured framework > (I favor Pylons) or write plain CGIs. IMO there is a third way: use wsgiref and/or paste.

Re: Python optimization (was Python's "only one way to do it" philosophy isn't good?)

2007-06-11 Thread Michele Simionato
duction. > Hoisting > common subexpressious out of loops. Hoisting reference count updates out of > loops. Keeping frequently used variables in registers. And elimination of > many unnecessary dictionary lookups. > > Python could get much, much faster. Right now CPython is said to be 60X > slower > than C. It should be possible to get at least an order of magnitude over > CPython. > > John Nagle This is already done in RPython: http://codespeak.net/pypy/dist/pypy/doc/coding-guide.html#restricted-python I was at the PyCon It conference the other day and one of the PyPy people claimed that RPython is up to 300X faster than Python. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-19 Thread Michele Simionato
lly view Scheme as a tool for language designers only, or with people with interest in language design and I don't use it for anything else. I see Python or C as much better practical implementations of Sussman's quote about minimalism than real Scheme (for an example of real Scheme, I

Re: "assert" annoyance

2007-06-23 Thread Michele Simionato
On Jun 22, 5:05 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Unit tests are not a magic wand that discover every problem that a > program could possibly have. +1 QOTW Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-23 Thread Michele Simionato
se them, including people with a Scheme/Lisp background. That should be telling you something. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python plain-text database or library that supports joins?

2007-06-23 Thread Michele Simionato
s? http://www.ikaaro.org/itools#itools.csv HTH, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-23 Thread Michele Simionato
on. > > -- > Lenard Lindstrom > <[EMAIL PROTECTED]> I would add to your list http://livelogix.net/logix/ and http://www.fiber-space.de/EasyExtend/doc/main/EasyExtend.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-23 Thread Michele Simionato
Python-centric) do not need macros. Provocative-but-with-a-grain-of-salt-in-it-yours, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: is this a valid import sequence ?

2007-06-24 Thread Michele Simionato
ave been wasted time. So f1 is misleading code, and I consider misleading code actually *worse* than wrong code, since it makes you waste your time without a good reason. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-24 Thread Michele Simionato
Warnings... x.py:4: Variable (longVarableName) not used [I know you will not be satisfied with this, but pychecker is really useful, since it catches many other errors that no amount of macroprogramming would evere remove]. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: is this a valid import sequence ?

2007-06-25 Thread Michele Simionato
f forever (whereas a bug *has* to be fixed, otherwise the application does not work). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Collections of non-arbitrary objects ?

2007-06-25 Thread Michele Simionato
r version. Or possibly try: do_func = elmt.some_func except AttributeError: do_stuff() else: do_func() (internally hasattr is doing that anyway). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-28 Thread Michele Simionato
On Jun 29, 6:44 am, Douglas Alan <[EMAIL PROTECTED]> wrote: > > I've written plenty of Python code that relied on destructors to > deallocate resources, and the code always worked. You have been lucky: $ cat deallocating.py import logging class C(object): def __init__(self): logging.

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-29 Thread Michele Simionato
On Jun 29, 3:42 pm, Douglas Alan <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > >> I've written plenty of Python code that relied on destructors to > >> deallocate resources, and the code always worked. > > You have been

Re: overriding base class

2007-06-29 Thread Michele Simionato
the reading and maintenance effort (see for instance the nightmarish situation in Zope 2). To the OP I would suggest to consider containment instead, to consider using proxy objects, __getattr__ and other similiar tricks that usually do the job. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI vs WSGI

2007-07-04 Thread Michele Simionato
On Jul 4, 2:49 pm, [EMAIL PROTECTED] wrote: > Dear all, > > what is the difference? Middleware? Yes, and also the fact that you have a large choice of WSGI web frameworks to choose from. CGI looks so much 20th century ... ;) Michele Simionato -- http://mail.python.org/mailman

Re: MethodType/FunctionType and decorators

2007-07-05 Thread Michele Simionato
On Jul 5, 3:41 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Alex already explained everything beautifully. I will just add a link to the definite guide to descriptors: http://users.rcn.com/python/download/Descriptor.htm Michele Simionato (who spent lot of brain cycles studying descript

Re: MethodType/FunctionType and decorators

2007-07-05 Thread Michele Simionato
On Jul 5, 11:16 am, Alex Popescu <[EMAIL PROTECTED]> wrote: > Guys, I appreciate a lot your help and explanations. It looks like I > have to read/play a bit more as some of the terms/ideas are pretty new > to me (coming to Python with a 10 years Java bag, and only with a > small dynlang bag - Ruby,

Re: MethodType/FunctionType and decorators

2007-07-05 Thread Michele Simionato
thon unittest framework should be old hat to you and not worth looking at). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing a read only attribute

2007-07-06 Thread Michele Simionato
If the read-only attribute has been implemented via a property, there is a way to write it, but you should tell us more about your case. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating logged functions using decorators

2007-07-07 Thread Michele Simionato
than Using my own decorator module (http://www.phyast.pitt.edu/~micheles/ python/documentation.html) that would be from decorator import decorator @decorator def log(f, *args, **kw): result = f(*args, **kw) print args, kw, result return result Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use Python for these programs?

2007-07-09 Thread Michele Simionato
and use the mouse to move the sample points along > the lines to tweak the sample locations if desired. Then output a file > of X,Y coordinates for the samples. You may look at dia for that. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Function parameter type safety?

2007-07-13 Thread Michele Simionato
or now is to follow the good advices you received, but keep in mind that there will be alternatives in the near future (such as interface checking/function overload). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread Michele Simionato
#x27;t care too much about the look&feel you may consider starting with Tkinter. Pros: 1. it is part of the standard library, and you already have it; 2. it is possibly the easiest/simplest GUI out there; 3. it runs pretty much everywhere with minimal fuss. Michele Simionato -- http:/

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-15 Thread Michele Simionato
method was defined in self.__class__.__dict__. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-15 Thread Michele Simionato
On Jul 16, 7:18 am, Erik Jones <[EMAIL PROTECTED]> wrote: > On Jul 15, 2007, at 11:23 PM, Michele Simionato wrote: > > > On Jul 16, 5:51 am, Erik Jones <[EMAIL PROTECTED]> wrote: > >> Say you're given a call event frame for a method call. How can you > >

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-25 Thread Michele Simionato
ffering symbolic prices (i.e. Python T-shirts or even silver plates) and -1 for cash. You could use the cash to fund other kind of initiatives (perhaps the forthcoming Italian Python conference? http://www.pycon.it ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-26 Thread Michele Simionato
On Apr 26, 7:23 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > I would be +1 for offering symbolic prices Oops, I meant prizes! M. S. -- http://mail.python.org/mailman/listinfo/python-list

Re: Access to raw command line?

2007-04-26 Thread Michele Simionato
, you might consider using the cmd module of the standard library instead. Then you could implement your own expansion, and you would have portability for non-Unix system too. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Scheduler Module Help

2007-04-26 Thread Michele Simionato
ny other > > operations in my application from running, its sits dormant until it > > runs the scheduled functions. sched is meant to be used with threads. A probably better alternative is to use an asynchronous framework (i.e. Twisted or a GUI) and use the native techniques to schedule function

Re: EuroPython vs PyconUK

2007-04-26 Thread Michele Simionato
that national (of course, not exclusively). I would be happy with a conference for any nationality. Each nation will have its national speakers. EuroPython will have all Europe to chose speakers from. BTW, this year I will go both to PyCon It and EuroPython, last year I went both to PyUK and EuroPy

Re: pre-PEP: Standard Microthreading Pattern

2007-05-01 Thread Michele Simionato
eld F(el) In other words, is ``fibsquared(n).next()`` should return a value or a generator object?? BTW, in spite of having a great tradition, the Fibonacci example sucks as a motivation for microthreading programming. You could show a simple state machine instead. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: DiffLib Question

2007-05-02 Thread Michele Simionato
ace characters (a blank or tab; **note**: bad idea to include newline in this!). Use of IS_CHARACTER_JUNK is recommended. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

how do you implement a reactor without a select?

2007-05-07 Thread Michele Simionato
them in the mainlooop if the current time is greater than the scheduled time. I had to add a time.sleep(.001) call in the default_action to avoid consuming 100% of the CPU in the loop. I wonder if real mainloops are done in this way and how bad/good is this implementation compared to a serious one.

Re: how do you implement a reactor without a select?

2007-05-07 Thread Michele Simionato
On May 7, 4:39 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Michele Simionato <[EMAIL PROTECTED]> wrote: > > I wonder if real mainloops are done in this way and how bad/good is > > this implementation compared to a serious one. Any suggestion/hint/ > > advice

Re: how do you implement a reactor without a select?

2007-05-07 Thread Michele Simionato
tion call. In that case as you say, I would be better off with a select+timeout or a even with a queue+timeout, which already do most of the job. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you implement a reactor without a select?

2007-05-07 Thread Michele Simionato
p design here is not so bad. Still I wanted to know what my alternatives were. And from this thread I gather the impression that actually the only portable alternative is using some kind of select, unless I want to use threads, and in that case the scheduler approach could be viable. Anyway, that C10K p

Re: how do you implement a reactor without a select?

2007-05-08 Thread Michele Simionato
On May 8, 11:23 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > I once played with the following module to do something similar. That looks interesting, I will have a look at it. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Is wsgi ready for prime time?

2007-05-17 Thread Michele Simionato
standard library) is intended for easy development and testing purposes, not for industrial strenght deployement. On the other hand Zope 3 uses Twisted via WSGI as a business class server, and I hear that mod_wsgi is slightly more performant than mod_python, so those are the first options I would consider. But you could post on the WSGI list for more. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Michele Simionato
ages. We're still wondering if we're the busiest one of all the python/ruby supported websites in the world. Quixote runs on one dual-core home-made server (costed us US$1500). We have three additional servers dedicated to lighttpd and mysql. We use memcached extensively as well. Douban.c

Re: Decorator question

2007-05-23 Thread Michele Simionato
func(*args,**kw) return update_wrapper(wrapper,func) class P(object): @classmethod @trace def c(cls): print cls p =P() p.c() Also, you can have a look to my own decorator module: http://www.phyast.pitt.edu/~micheles/python/decorator.zip HTH, Michele Simionato

Re: decorators tutorials

2007-07-23 Thread Michele Simionato
s > topic. > > Thanks > james Look at the decorator page in the Python Wiki. There is also a paper by David Mertz on IBM DeveloperWorks. Finally, you may have a look at my own work http://www.phyast.pitt.edu/~micheles/python/documentation.html Michele Simionato -- http:/

Re: Python end of file marker similar to perl's __END__

2007-07-31 Thread Michele Simionato
y > program. Does python have something similar? > > Thanks, > Geoffrey I wished from something like that. What you can do at the moment, is to comment or triple quote the code you don't want to run. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

is there anybody using __del__ correctly??

2007-08-10 Thread Michele Simionato
in subprocess and popen2, where __del__ updates the list of active processes. So I am beginning to wonder if there exists good use cases for __del__, apart for debugging/checking purposes. Can you provide some? Yes, you may take that as a challenge ;) Michele Simionato P.S. BTW, I should m

Re: Deleting objects on the fly

2007-08-09 Thread Michele Simionato
is the gc who does the real job. See http://docs.python.org/ref/customization.html#l2h-175 Do you have reference cycles in your application? You should tell us something more. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: is there anybody using __del__ correctly??

2007-08-10 Thread Michele Simionato
On Aug 10, 7:09 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > There were also a few recipes posted during this discussion that wrap > weakrefs up a bit nicer so it's easier to use them in place of __del__: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/519635http://aspn.activestate.c

Re: is there anybody using __del__ correctly??

2007-08-11 Thread Michele Simionato
(ref) cls.__finalize__(self) fake = Impostor(self) _refset.add(weakref.ref(fake, finalize)) return fake def __finalize__(self): pass Hope you will enjoy it, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators - more than just syntactic sugar

2007-08-12 Thread Michele Simionato
r only) and having or not having a given syntactic sugar makes a difference between writing and not writing a given program. Having decorators in core Python makes us think differently. Have a look at David Mertz article http://www.ibm.com/developerworks/linux/library/l-cpdecor.html Michele S

Re: is there anybody using __del__ correctly??

2007-08-12 Thread Michele Simionato
On Aug 12, 9:14 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Michele Simionato wrote: > > On Aug 10, 7:09 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > >> There were also a few recipes posted during this discussion that wrap > >> weakrefs up a bit nicer

Re: is there anybody using __del__ correctly??

2007-08-13 Thread Michele Simionato
upgrade path for current code using __del__ does not look easy at all. Maybe we should be bold, remove __del__ in Py3K, say to everybody to use 'with', and force people to rewrite their code, ignoring the complaints from the big frameworks guys (anyway, they are already complaining ;)

Re: decorators - more than just syntactic sugar

2007-08-13 Thread Michele Simionato
On Aug 13, 7:46 pm, Alexander Schmolck <[EMAIL PROTECTED]> wrote: > Michele Simionato <[EMAIL PROTECTED]> writes: > > Well, I argued may times that syntactic sugar is important (all Turing > > complete languages differs by syntactic sugar only) > > Although I

restoring the default completer in IPython

2007-08-21 Thread Michele Simionato
looking at the source code of IPShellEmbed I see that there is a method .restore_system_completer() which is called, but it seems to be not working. I am probably doing something wrong, can somebody knowledgeable on IPython internals share some light on that? TIA, Michele Simionato -- http

Re: lisper learning python, ... could you please comment my first python program?

2007-08-26 Thread Michele Simionato
look at the shlex module in the standard library and to pyparsing. Looking at their source code should should give you some idea. BTW, since you are familiar with Lisp, I would recommend you IPython for a better interactive experience. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-08-28 Thread Michele Simionato
self to know if there are users of these frameworks (including AOP frameworks in Python) or if they are just exercises. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Michele Simionato
On Aug 29, 8:45 am, Russ <[EMAIL PROTECTED]> wrote: > I get the strong impression you don't really understand what > programming by contract is. > > I have not yet personally used it, but I am interested in anything > that can help to make my programs more reliable. If you are > programming somethi

<    1   2   3   4   5   6   7   8   9   >