Re: Python Object Systems

2014-08-14 Thread Michele Simionato
Il giorno mercoledì 13 agosto 2014 19:13:16 UTC+2, thequie...@gmail.com ha scritto: > What is the difference between traits and roles? People keep using the same names to mean different concepts. For me traits are the things described here: http://www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTra

Re: Hierarchical commnd line parsing / help texts

2011-09-28 Thread Michele Simionato
plac is based on argparser and it is intended to be much easier to use. See http://plac.googlecode.com/hg/doc/plac.html Here is an example of usage. $ cat vcs.py class VCS(object): "A fictitious version control tool" commands = ['checkout', 'commit'] def checkout(self, url): r

Re: Decorating functions without losing their signatures

2013-04-03 Thread Michele Simionato
On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote: > After thinking about it for a while I've come up with the following > > abomination Alas, there is actually no good way to implement this feature in pure Python without abominations. Internally the decorator module does something s

Trying to understand the memory occupation of big lists

2013-05-03 Thread Michele Simionato
I have a memory leak in a program using big arrays. With the goal of debugging it I run into the memory_profiler module. Then I discovered something which is surprising to me. Please consider the following script: $ cat memtest.py import gc from memory_profiler import profile @profile def test

inserting/retriving dates in psycopg

2006-01-04 Thread Michele Simionato
e(d) and NOT a datetime.datetime. So I need an adaptation mechanism; alternatively it would be enough for me to be able to redefine the __str__ representation of psycopg DateTime objects ( which are defined at C level, so I cannot just override the __str__ method). Any hints? I am sure there is a custom way to do this. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-04 Thread Michele Simionato
Kirk Strauser: > I wrote this article which was published in Free Software Magazine: > http://www.freesoftwaremagazine.com/free_issues/issue_09/intro_zope_1/ If find funny your headline """ Zope's biggest distinguishing characteristic is how closely it models the language it is written in: Python

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Michele Simionato
he type checking I would like to avoid :-/ Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-05 Thread Michele Simionato
Some of the reasons are explained here: http://www.amk.ca/python/writing/why-not-zope.html I am using the last Zope (2.8.4) at work, and the situation is slightly better now than in the past, but only slightly. Zope 3 looks better, but I am not sure how much better. Michele Simionato

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Michele Simionato
Frank Millan: > Perhaps if you explain what you are trying to do, I may be able to > suggest something. I am looking for an adaptation/type cast mechanism and looking at the sources I think I have found it in doc/examples/usercast.py. I am doing some experiment now ... Michele Sim

Re: decorator question

2006-01-09 Thread Michele Simionato
Schüle Daniel wrote: > Can someone give me some pointers to the metaprogramming in Python? > links etc Check the Python Wiki. For the decorators in particular I wrote a module that you may find useful. See http://www.phyast.pitt.edu/~micheles/python/decorator.zip http://www.phyast.pitt.edu/~miche

Re: Spelling mistakes!

2006-01-09 Thread Michele Simionato
emory optimization trick and should NOT be used as declarations. You can find a few posts of the Martellibot on the subject. I even wrote a recipe to tell people who want static declarations how to implement them without slots: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158

Re: Spelling mistakes!

2006-01-09 Thread Michele Simionato
I like to play devil's advocate here, so I will say that in this case using automatic testing will increase your probability of spelling mistakes: I do most of my spelling mistakes in the test cases! <0.5 wink> Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: testing units in a specific order?

2006-01-09 Thread Michele Simionato
You could use py.test -- http://mail.python.org/mailman/listinfo/python-list

Re: testing units in a specific order?

2006-01-09 Thread Michele Simionato
be found in the tool directory of > the py-lib. This looks new. Can you comment on how utestconvert.py work and how reliable is it? Thanks, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-10 Thread Michele Simionato
> Scott David Daniels about marking expected failures: I am +1, I have wanted this feature for a long time. FWIW, I am also +1 to run the tests in the code order. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Client side web programming

2006-01-10 Thread Michele Simionato
> Pramod Subramanyan asked aboyt urllib2: Look at this article: http://www.voidspace.org.uk/python/articles/urllib2.shtml Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-11 Thread Michele Simionato
t unittest is already cumbersome how it is, I would not touch it. Instead, I would vote for py.test in the standard library. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: how do "real" python programmers work?

2006-01-13 Thread Michele Simionato
As many others, I use emacs for programming and ipython for interactive experiments. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining if an object is a class?

2006-07-12 Thread Michele Simionato
[EMAIL PROTECTED] wrote: > I need to find out if an object is a class. > Which is quite simply awful...does anyone know of a better way to do > this? inspect.isclass M.S. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dispatch with multiple inheritance

2006-07-18 Thread Michele Simionato
pt. of Computer Science > http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA Look at http://www.python.org/download/releases/2.3/mro Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Using super()

2006-07-19 Thread Michele Simionato
yle) == type There should be something more on http://www.python.org/download/releases/2.2.3/descrintro (I have seen somewhere how type.__new__ works, and how the metaclass is chosen, so I am pretty sure sure there are no issue, at least for pure Python classes). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Michele Simionato
attr, if you don't want to use inheritance. It would be still better that magically transform your classes with a metaclass. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Using super()

2006-07-19 Thread Michele Simionato
Michele Simionato ha scritto: > I believe the new style system was designed to allows this sort of > mixing and > that there are no issues at all. Thinking a bit more, there are no issues at all if you know what a new style class is and if you do not expect it to work as an old-style o

Re: Need a compelling argument to use Django instead of Rails

2006-07-25 Thread Michele Simionato
Joe Knapka ha scritto: > Classes are effectively open in Python, too, at least > where methods are concerned, since one can do > klass.__dict__["myMethod"]=myMethod. Yes, but builtin classes in Python are closed and this is the relevant point. Michele

Re: Class attributes, instances and metaclass __getattribute__

2006-08-08 Thread Michele Simionato
he attributes of a metaclass are available to its instances, but not to the instances of the instances. Just this is the main difference between metaclasses and superclasses.""" Since this happens for real attributes, it looks natural that the same should happen for 'virtual' attributes implemented via '__getattr__' or '__getattribute__'. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Info on continuations?

2006-08-08 Thread Michele Simionato
supports them. For instance this is a recent reference for continuations in Scheme: http://www-128.ibm.com/developerworks/linux/library/l-advflow.html?ca=dgr-lnxw02FlowControl Ruby should have support for continuations too, but I am quite ignorant about the Ruby literature. Michele S

Re: creating many similar properties

2006-10-17 Thread Michele Simionato
rc.pwm02 # 127 rc.pwm02 = 1312 print rc.pwm02 # 32 This is a bit hackish, but I would prefer this over a metaclass solution. since it does not add any hidden magic to your class. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: creating many similar properties

2006-10-18 Thread Michele Simionato
s (i.e. extensions classes), or try to use multiple metaclasses. I wrote a paper about metaclasses abuses which should be published soon or later; you can see the draft here: http://www.phyast.pitt.edu/~micheles/python/classinitializer.html Michele Simionato -- http://mail.python.org/mailman/listinfo/

Re: creating many similar properties

2006-10-18 Thread Michele Simionato
k and you will avoid all issues of custom metaclasses. This is exactly the approach I advocate in the paper I referred before, so I think your solution is pretty safe in that respect. Still I think in this particular problem avoiding the __metaclass__ at all is possible and it should be preferred, just

Re: creating many similar properties

2006-10-18 Thread Michele Simionato
t all. Please, do this experiment: take all classes defined in the Python standard library and add to them a custom do-nothing metaclass. See what happens. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: creating many similar properties

2006-10-18 Thread Michele Simionato
Carl Banks wrote: > Come on, I don't think anyone's under the impression we're being > indiscriminate here. Ok, but I don't think that in the case at hand we should recommend a metaclass solution. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Save/Store whole class (or another object) in a file

2006-10-18 Thread Michele Simionato
he documentation: http://docs.python.org/dev/lib/pickle-inst.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: creating many similar properties

2006-10-19 Thread Michele Simionato
om/ASPN/Cookbook/Python/Recipe/204197) but I would rather avoid it altogether. The problem with metaclasses is that you are adding magic to the classes of your USERS, and the users are known to play any kind of dirty tricks. You (speaking in general of you as the author of a framework) should strive to keep things clean as much as possible. I agree that the problems are rare: but just for this reason they are prone to very subtle bugs, the hardest to find. And there is no documentation of metaclass pittfall AFAIK :-( Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: creating many similar properties

2006-10-19 Thread Michele Simionato
and using 'type' instead (i.e. use the __metaclass__ hook, but not custom metaclasses). It is the same trick used by George Sakkis in this same thread. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: how is python not the same as java?

2006-11-10 Thread Michele Simionato
gavino wrote: > both are interpreted oo langauges.. Notice that gavino has a long history of asking trollish questions in Lisp and Scheme newsgroups and he displays the typical behavior of a troll. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: explicit self revisited

2006-11-13 Thread Michele Simionato
a while one gets used to it and if you think a bit it makes quite a lot sense. Also, having the self explicit, makes Python object system better (i.e. it goes more in the direction of CLOS and less in the direction of Java). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: article on Python 2.5 features

2006-11-13 Thread Michele Simionato
t IndexError: if token != '': yield token if __name__=='__main__': print '--- Smart Python 2.2+ tokenizer ---' g = read_eval_yield_loop(tokenizer3, text, ' ') for t in g: print t if t == 'comma': g.send(',') Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: handling many default values

2006-11-13 Thread Michele Simionato
vars(self).update(kwargs) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: handling many default values

2006-11-14 Thread Michele Simionato
Gabriel Genellina wrote: > At Monday 13/11/2006 13:33, Michele Simionato wrote: > > >Alan Isaac wrote: > > > Also, as an aside, no one objected to using > > > self.__dict__.update(kwargs) > > > in the __init__ function of the parameter holding class. >

tracking dependencies

2006-06-08 Thread Michele Simionato
there should be an option to turns off the visualization of certain modules, for instance the ones in given subpackages. I guess somebody has already written it, maybe even with a nice visual backend. Any hint? Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: tracking dependencies

2006-06-09 Thread Michele Simionato
Dennis Benzinger wrote: > > I've never tried it, but http://www.tarind.com/depgraph.html looks like > what you are looking for. This is EXACTLY what I had in mind :-) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Correctly reading stdout/stderr from subprocess

2006-06-15 Thread Michele Simionato
Maric Michaud wrote: I would consider avoiding threads via Twisted utils.getProcessOutput: http://twistedmatrix.com/projects/core/documentation/howto/process.html#auto6 Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is fun (useless social thread) ;-)

2006-06-15 Thread Michele Simionato
thon&rnum=3#3d77eba36a97751d Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is fun (useless social thread) ;-)

2006-06-15 Thread Michele Simionato
corator.zip http://www.phyast.pitt.edu/~micheles/python/documentation.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a good programming text editor (not IDE)

2006-06-16 Thread Michele Simionato
about arguing for Emacs since everything is already explained here: http://www.dina.kvl.dk/~abraham/religion Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: code is data

2006-06-19 Thread Michele Simionato
spectful of all the work people like Steven Bethard and others did :-( Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic inheritance

2006-06-21 Thread Michele Simionato
in a running program with a problem you can add debug methods and possibily even fix the problem without restarting the program). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Michele Simionato
classname, *attributes): cls = type(classname, mybases, mydic) for name, value in attributes: setattr(cls, name, attr) return cls is the typical solution for your use case. OTOH, if you are looking for use classes for metaclasses, look at the Python Wiki and use Google. Michele Simionato

Re: TypeError: Cannot create a consistent method resolution order (MRO) for bases object

2006-06-27 Thread Michele Simionato
[EMAIL PROTECTED] wrote: > What are the reason one would get this error: TypeError: Cannot create > a consistent method resolution order (MRO) for bases object ?? See http://www.python.org/download/releases/2.3/mro/ Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you use this list ?

2006-06-27 Thread Michele Simionato
want to ask > how do you use this list , reading every mail come in or just read what > you think > interesting ? > > Thank you ! > > > Best Regard ! I use the newsgroup: http://groups.google.com/group/comp.lang.python Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a new object definition

2006-09-01 Thread Michele Simionato
peps/pep-0359 (already rejected by Guido). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a new object definition

2006-09-01 Thread Michele Simionato
Sylvain Ferriol wrote: > Michele Simionato a écrit : > > > > See http://www.python.org/dev/peps/pep-0359 (already rejected by > > Guido). > > > i do not understand the withdrawal note, what do "different level" mean ? > do you have an example or is it py

Re: What are super()'s semantics?

2006-09-04 Thread Michele Simionato
world. Anyway, the MRO concept is documented here: http://www.python.org/download/releases/2.3/mro/ (yes, it is not easy to find this link in python.org). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Javadoc style python manual?

2006-09-08 Thread Michele Simionato
Ben Sizer wrote: > I agree that the Python docs aren't quite as effective as reference > material due to the lack of simple function and method lists though. http://docs.python.org/lib/modindex.html, pydoc and ipython are more than enough for me. Michele Simionat

Re: Javadoc style python manual?

2006-09-08 Thread Michele Simionato
Ben Sizer wrote: > Michele Simionato wrote: > > Ben Sizer wrote: > > > I agree that the Python docs aren't quite as effective as reference > > > material due to the lack of simple function and method lists though. > > > > http://docs.python.org/l

Re: super and __init__

2006-09-11 Thread Michele Simionato
Noah wrote: > Am I the only one that finds the super function to be confusing? No, see for instance http://fuhm.net/super-harmful/ Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: descriptor problems

2006-09-14 Thread Michele Simionato
;__set__' You need to define the descriptor at the metaclass level too. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I get the function's caller?

2006-09-14 Thread Michele Simionato
ot defined yet" > > regards > David Check also the warnings module (it will give you also line number information for free). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Michele Simionato
by the user in HTML hidden widgets. Sometimes the simplest solutions are the better ones ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Adding Functionality to the Overall System

2006-09-20 Thread Michele Simionato
(I don't believe I am responding to a notorious troll ...) One (bad) solution is to write in your sitecustomize.py the following: $ echo /usr/lib/python/sitecustomize.py import __builtin__ class Object(object): def debug(self): print 'some debug info' __builtin__.object = Object th

Re: Request for elucidation: enhanced generators

2006-09-21 Thread Michele Simionato
am not claiming that this is a good idea. Michele Simionato --- import datetime import cherrypy as cp # each user (but really should be each session) has her input loop # one should disable the back button and implement an undo mechanism def inputloop(user): start_time = datetime.datetime.to

Re: Decorator cllass hides docstring from doctest?

2006-09-21 Thread Michele Simionato
t the mistake. I wrote a module to avoid this kind of issues, so you may want to check it out: http://www.phyast.pitt.edu/~micheles/python/documentation.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remember login in zope?

2006-09-25 Thread Michele Simionato
cmf or plone , how could i handle this? > thanks a lot. > > i'm working around this for two days and surfing a lot of pages but > still felt confused, any suggestion would be appreciated. This is the wrong list. See http://www.zope.org/Resources/MailingLists Michele Simio

Re: a different question: can you earn a living with *just* python?

2006-09-27 Thread Michele Simionato
now Python you can earn your living. Heck, there are people knowing Visual Basic only that earn their living! ;) Anyway, at work I use Python and SQL only (and a bit of bash and HTML). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-27 Thread Michele Simionato
Python only. Notice that by "knowing Python" I mean also knowing its standard library and the most common Python third party libraries (GUI toolkits, XML toolkits, SQL libraries, twisted, etc. etc.) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-28 Thread Michele Simionato
mmers don't. Yep, I think that's the point. Worth repeating (and +1 for QOTW). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-28 Thread Michele Simionato
Ruby it is not really different from Python in terms of learning "new ways of programming". Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: a different question: can you earn a living with *just* python?

2006-09-28 Thread Michele Simionato
this stuff, you are likely to be able to learn any language. My point was that when hiring a programmer, one should also look at the potential of the person, not only at his/her present skills. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: postgresql database

2006-10-02 Thread Michele Simionato
t; > import psycopg > ImportError: No module named psycopg > > come mai? va settata qualche path oltre a quella di postgresql ? > > grazie dell'aiuto Well, if you are using Psycopg2, do import psycopg2 (and please use the italian mailing list for questions in Italian).

Re: string: __iter__()?

2006-10-04 Thread Michele Simionato
sequence of characters) and I can check hasattr(obj, '__iter__') to distinguish (for instance) a list of strings from a single string (typically in recursive algorithms working on texts). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a reason not to do this?

2006-12-01 Thread Michele Simionato
e, func) return func return decorator @defmethod(C) def m1(self, x):pass help(m1) BTW, for people with a Lisp background I recommend using IPython with emacs and the ipython.el mode. It is pretty good, even if not comparable to Slime. Michele Simio

Re: Functions, callable objects, and bound/unbound methods

2006-12-01 Thread Michele Simionato
nctions and Methods" in > http://users.rcn.com/python/download/Descriptor.htm > > You need to implement a __get__ method on your class. See also http://groups.google.com/group/comp.lang.python/browse_frm/thread/d691240a5cfebcdf/93503c5b9c66226e?lnk=gst&q=simionato+subclassing+Fu

Re: Is there a reason not to do this?

2006-12-02 Thread Michele Simionato
not obj.__class__: obj.__class__ = cls class C(object): # old class def m1(self): return 1 c = C() # old instance assert c.m1() == 1 class C(object): # new class def m1(self): return 2 update(c) # old instance updated assert c.m1() == 2

Re: Is there a reason not to do this?

2006-12-02 Thread Michele Simionato
27;Q' assert c.m1() == 'Q' assert c.__class__.__module__ == __name__ # make sure c.__class__ is defined in the current module Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: About the 79 character line recommendation

2006-12-06 Thread Michele Simionato
t against extra-large one-liners. Finally, notice that you can alwasys aliases if you are a lazy typist: shortcut = LongClassName.LongAttributeName This also saves an attribute access and gives you some additional speed, which may be useful in some cases. Michele Simionato -- http://mail.p

Re: What are python closures realy like?

2006-12-06 Thread Michele Simionato
u want persistency (you cannot pickle a closure) so in that case I use a callable object instead. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-11 Thread Michele Simionato
Timofei Shatrov wrote: > It's not surprising that no one uses this stuff for serious work. Well, I replaced all my unittests with doctests long ago, and I am not the only one following this way (see the Zope 3 project for instance). Michele Simionato -- http://mail.python.org

Re: merits of Lisp vs Python

2006-12-11 Thread Michele Simionato
Paul Rubin wrote: > "Alex Mizrahi" <[EMAIL PROTECTED]> writes: > > > "Programming Languages:Application and Interpretation" > > Shriram Krishnamurthi > > Brown University > This book doesn't seem to be online. http://cs.brown.edu/~sk/Publ

Re: alternate language

2006-12-11 Thread Michele Simionato
doesn't take 60 hour weeks over years to master > Chicken Scheme: http://www.call-with-current-continuation.org (not sure about wx, but there are various GUI wrappers available) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Defining classes

2006-12-14 Thread Michele Simionato
Nick Maclaren wrote: > It would be much cleaner not to have to fiddle with static > members after the class is initialised. You can hide the fiddling, for instance with the trick explained here: http://www.phyast.pitt.edu/~micheles/python/classinitializer.html Michele Simionato --

Re: Multiple inheritance and __slots__

2006-12-14 Thread Michele Simionato
e even if one does not care about > memory. See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158 (how to freeze Python classes) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Defining classes

2006-12-15 Thread Michele Simionato
ay that you are using the metaclass hook here, but not a "real" metaclass. Still waiting for class decorators ... Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Metaclass uses?

2006-12-18 Thread Michele Simionato
http://www.phyast.pitt.edu/~micheles/python/classinitializer.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

How a script can know if it has been called with the -i command line option?

2006-12-21 Thread Michele Simionato
The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? TIA, Michele Simionato --

Re: How a script can know if it has been called with the -i command lineoption?

2006-12-21 Thread Michele Simionato
Hendrik van Rooyen wrote: > "Michele Simionato" <[EMAIL PROTECTED]> wrote: > > > > The subject says it all, I would like a script to act differently when > > called as > > $ python script.py and when called as $ python -i script.py. I looked > &g

Re: program deployment

2007-01-05 Thread Michele Simionato
the code written by others. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: General Question About Python

2007-01-09 Thread Michele Simionato
think of something to get yourself visibile (i.e. contribute to some OSS project, write articles, partecipate to conferences, etc.) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: The problem of anonymity with decorators

2006-02-07 Thread Michele Simionato
or, "should return int" TypeError: should return int The reason of is that the module internally uses 'exec'. There should be a way around that, anyway, but I have no time to check it right now. Still, the module may be of inspiration to you. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: super(...).__init__() vs Base.__init__(self)

2006-02-09 Thread Michele Simionato
I remember there was somewhere a page called "super considered harmful", some googling should find it. It was discussing the issue you are alluding to, as well others. Also google in the newsgroup, there are lots of threads about super and its shortcomings. Michele Simionato

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Michele Simionato
production, > maintenance and reuse costs of python code considerably, so much in fact that > python's very slowness represents part of its competetive edge over languages > that are in some ways better engineered and more capable. I think you have a very good point here. +1000! Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

streaming Popen.stdout

2006-02-21 Thread Michele Simionato
e every seconds. How can I get that in a simple way? A Unix-only solution would be fine, too. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Michele Simionato
hat is happening. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Michele Simionato
of use nothing beats CherryPy, but I am not sure how stable it is. Quixote is nice and small, and pretty easy to use too. Many likes Django and TurboGears. Zope and Twisted are for people who have a lot of time to invest. Michele Simionato -- http://mail.python.org/mailman/listinfo/python

Re: Python vs. Lisp -- please explain

2006-02-22 Thread Michele Simionato
first point on interactive sessions, are you aware of Michael Hudson's recipe "automatically upgrade class instances on reload()" http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 ? Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: streaming Popen.stdout

2006-02-23 Thread Michele Simionato
Replying to myself ... I cooked up this solution involving os.pipe and os.fork, but I am not especially happy with it; anyway, let me write it. Feedback is welcome, since this was written very quickly and I may have missed something. BTW, are there libraries out there doing something similar? ---

Re: Write a GUI for a python script?

2006-03-02 Thread Michele Simionato
Tkinter is the GUI toolkit that comes with Python and is available on all platform without any installation effort. It is quite OK for simple things and I would recommend it for any beginner. Google for "An Introduction to Tkinter" by F. Lund. Michele Simionato -- http://mail.

Re: Reusing object methods?

2005-05-01 Thread Michele Simionato
about the resolution order etc.) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: MRO problems with diamond inheritance?

2005-05-01 Thread Michele Simionato
> M.E.Farmer: >Your answer lies somewhere in this page ;) >http://www.python.org/2.2.2/de­scrintro.html Yes, when it refers to http://www.python.org/2.3/mro.html (section Bad Method Resolution Orders). In short, it is a feature, not a bug. Michele Simionato

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
e class. So you can override it without problems, and still access it as type.mro(cls). For more about metamethods see http://www-128.ibm.com/developerworks/linux/library/l-pymeta2/index.html Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: MRO problems with diamond inheritance?

2005-05-02 Thread Michele Simionato
'purpose' of classmethods. In my personal opinion classmethods and staticmethods could (and possibly should) be removed from the language; a part for that consideration, the typical use for classmethods is as object factories, to provide alternative constructors. Miche

<    1   2   3   4   5   6   7   8   9   >