Google for "Hettinger interface checking": the first hit
is the cookbook recipe you are looking for.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
"
But what about threads? If a single program open a shelve and many
threads
try to write simultaneously to it, do I get an error? I would say yes,
but after various attempts, I cannot get it, at least on Linux, where
shelve is using dbhash as database. Can somebody share any light,
please?
Look at the comment in the code! I have posted the "decorate" module in
the this
decorator thread:
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/60f22ed33af5dbcb/b7239b45da6a67ab#b7239b45da6a67ab
--
http://mail.python.org/mailman/listinfo/python-list
Dirk wrote:
> So I dug through the documentation and found that new-style classes
> compute a monotonic linearization of the inheritance graph, observing
>local precedence order, using the algorithm also used in Dylan
> described here:
>http://www.webcom.com/haahr/dylan/linearization-oopsla96.html
the
same parameters, I am returned an instance of the already opened
database).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
special case. It also gives you
plenty of use case to illustrate it, even to beginner programmers.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I did not put memoize on __new__. I put it on the metaclass __call__.
Here is my memoize:
def memoize(func):
memoize_dic = {}
def wrapped_func(*args):
if args in memoize_dic:
return memoize_dic[args]
else:
result = func(*args)
mem
Me too :-(
I have already submitted my issues with the Italian keyboard
on WinXP with no great success. It works on Linux, but this
is not of a big help since my plan was to use ipython -p pysh on
Windows as a replacement of the shell :-(
Michele Simionato
--
http://mail.python.org
Uhm? If I pass different parameters I want to have
different instances. The Singleton behaviour is recovered
only when I pass always the same arguments, in
particular when I pass 0-arguments:
>>> class Foobar:
... __metaclass__ = Memoize
...
>>> Foobar()
<__main__.Foobar object at 0xb7defbcc>
e 'argv'
Why my script doesn't have sys.argv?
Is there another way to use PyChart into my script?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Lee Harr wrote:
On 2005-04-12, Michele Petrazzo <[EMAIL PROTECTED]> wrote:
I'm using PyChart like a module for create charts into a little web
site, but when I try to create one, I have this error:
/var/www/html/lgt/draw.py:19, in draw:
can = canvas.init(self.file_name)
/usr/lib/pyt
Switching to the US keyboard did not help for me.
--
http://mail.python.org/mailman/listinfo/python-list
feel that:
1) separation of concerns is of the utmost importance;
2) classes should be kept as short as possible.
Notice that in this design getters and setters are
really hidden from the user, which may be or may be
not what you want.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
port SF 729913
The discussion around the bug report is worth reading,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
od and actually they were surprised of how easy was to make the
port.
All in all, pretty good news, people! It seems a pretty good moment
to be a Python programmer!
I have something else to say, but I will make another post for that.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
enlets. They are extremely cool,
I don't know where I want to use them yet, but I am pretty sure I'll
figure out something eventually ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
developers
are familiar with Zope 3 yet). Quixote too has a small
number of developers, but at least it is easy and you
don't need much help to work with it.
Michele Simionato
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
$ python -i myscript.py
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I would also look at CherryPy, the new 2.0 version seems pretty
interesting
(I have not tried it, but I have seen a short presentation at the ACCU
conference,
and it looks really trivial to use).
--
http://mail.python.org/mailman/listinfo/python-list
red of
components, hundreds of thousand of lines of code) or small?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
d small, in theory. But in practice
there is, so I use Zope at work and Quixote at home ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Any class has a .__module__ attribute giving the name
of the module where the class was defined, so you
need something like
[c for c in globals() if inspect.isclass(c) and c.__module__ ==
"__main__"]
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Uwe Mayer:
> Why does the "print" statement return a syntax error here?
Google for "Python regrets" where Guido admits that
'print' should have been a function.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I have not access to Guido's time machine!
M. S.
--
http://mail.python.org/mailman/listinfo/python-list
I think doctest believes the line starting with ... is
a continuation line in a multiline statement.
--
http://mail.python.org/mailman/listinfo/python-list
I would file a bug report/documentation bug/feature
request or whatever to sourceforge.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
files, which was easy to add. It was also smaller,
easier to understand and to customize. Its speed was more than enough.
However I hear that everybody else is happy with lxml, so YMMV.
Michele
--
https://mail.python.org/mailman/listinfo/python-list
Years ago I wrote strait: https://pypi.python.org/pypi/strait
I wonder who is using it and for what purpose, since surprisingly enough it has
50+ downloads per day. For me it was more of an experiment than a real project.
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
he type checking I would like to avoid :-/
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
You could use py.test
--
http://mail.python.org/mailman/listinfo/python-list
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
> 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
> 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
[EMAIL PROTECTED] wrote:
> Michele> I am also +1 to run the tests in the code order.
>
> Got any ideas how that is to be accomplished short of jiggering the names so
> they sort in the order you want them to run?
>
> Skip
Well, it could be done with a decorator, bu
As many others, I use emacs for programming and ipython for interactive
experiments.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
anges from 1.1.0:
Start the port to a more pythonic interface. See Image class
documentation (or the examples)
A bug in *nix mode that cause a problem when getStatus are called
Michele Petrazzo
--
http://mail.python.org/mailman/listinfo/python-list
[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
Hi list,
I have to know if a module are present on the system, but I don't want
to import it. Only know if it is present.
I think that a loop on the site-packages directory can do the work, but
is there another solution?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
>> more module.py
> print "I'M MODULE!"
>
>> python
>>>> import imp imp.find_module("os")
It was!
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
C." It's "Look what a paradise
Python offers you!" (I think maybe I liked the old sermons better.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^http://mail.python.org/mailman/listinfo/python-list
nd_20py2exe
>
> Thank you -Daniel
>
Michele
--
http://mail.python.org/mailman/listinfo/python-list
FreeImagePy. It's not so
difficult, but now I haven't time to do it. If you want to spend some
hours for make enjoying yourself and all the python community, email me! :)
> /BJ
>
>
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
ly this! All the tags code for
add/remove/modify them are already inside freeimage!
> See you,
>
> Dilly
>
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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
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/
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
h the class dict upon creation);
> whereas if you use Michele Simionato's hack, the icky feeling of using
> a stack frame object goes away after the property is created: you are
> left with a clean untainted class.
Yep, exactly.
> Personally, the former doesn't make me feel icky a
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
he documentation:
http://docs.python.org/dev/lib/pickle-inst.html
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
TO32 ),
and it'll work.
Or update to the new svn version (r21), that adds the
__iter__ method for the Image class. Now you can do this:
fname = "01-PJ2306.tif"
img = FIPY.Image(fname)
for bmp in img:
new_img = bmp.thumbnail(300)
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
vars(self).update(kwargs)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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.
>
method:
>>> class X(Structure):
... _fields_ = [("x", c_int), ]
...
>>> x1 = X(1)
>>> x1.x
1
>>>
http://starship.python.net/crew/theller/ctypes/tutorial.html ->
Structures and Unions
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Iain King wrote:
> Michele Petrazzo wrote:
>> Iain King wrote:
>>> Michele Petrazzo wrote:
>>>
>>> I downloaded and installed 0.9.9.3, and it now works. Thanks!
>>>
>> I advice you to don't use that ctypes version... Better is to use
Iain King wrote:
>> Can you download the last svn version from sf.net? Otherwise I'll send
>> you the last sources privately.
>>
>> Bye,
>> Michele
>
> I got the TortoiseSVN client though, and
> checked out your newest build, copied it over the to
mage at: http://www.snakebomb.com/misc/example.tif
>
> Iain
>
Yes it's min-is-white::
michele:~$ tiffinfo example.tif
TIFFReadDirectory: Warning, example.tif: unknown field with tag 37680
(0x9330) encountered.
TIFF Directory at offset 0x1520 (5408)
Subfile Type: (0 = 0x0)
Im
David Isaac wrote:
> I am just starting to think about image processing. What are the
> overlaps and differences in intended functionality between
> FreeImagePy and PIL?
>
> Thanks, Alan Isaac
>
>
http://tinyurl.com/m5kal
For any other questions, I'm here
ccess, to make the "convertToPil" function work
with 1, 8, 16 bpp... Seem that only 24/32 work, but I don't know why.
I know that PIL doesn't have problems!
>
>
>
Hope that this can explain better the situation.
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
thon&rnum=3#3d77eba36a97751d
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
corator.zip
http://www.phyast.pitt.edu/~micheles/python/documentation.html
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
ay occur when you use the /GR and the /MD compiler switches
"""
so my question are: python are compiled with that switches? If yes, can
someone try to compile it without that switches, if it can of course,
and publish the new installer? I'm can't work until microsoft solve
Chris Lambacher wrote:
> On Fri, Jun 16, 2006 at 06:11:53PM +0000, Michele Petrazzo wrote:
>> Hi list, just found in this moment that my applications stop to
>> work with win xp and receive this error:
>>
>> """ This application has requested the Ru
Normally py2exe catch that messages and show them when the program are
closed, but in this case, I don't see any message :(
Is it possible that some, but I don't know what, can be modified from
py2.3 to py2.4 and now my program wont work?
Is there some tried that I can do for try to solve my issue?
>
>
>
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
spectful of
all the work people like Steven Bethard and others did :-(
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
Chris Lambacher wrote:
> On Sat, Jun 17, 2006 at 07:32:34AM +0000, Michele Petrazzo wrote:
>> Chris Lambacher wrote:
>>> On Fri, Jun 16, 2006 at 06:11:53PM +, Michele Petrazzo wrote:
>>>
>>>> Hi list, just found in this moment that my applications sto
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
[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
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
get started?
> (e.g. win32 COM?)
win32COM for do what?
You can do it in not so difficult manner:
Take twisted and its proxy class, make some outline code (for filter the
pages) and enjoy! (work also on win)
>
> Thanks much -- matthew
>
P.s. Don't forgot to share your code, wh
Hi ng,
what the preferred way for see if the dict has a key?
We have a lot of solutions:
key in dict
key in dict.keys()
dict.has_key(key)
...
but what the better or the more "pythonic"?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Michele Petrazzo wrote:
>
>> what the preferred way for see if the dict has a key?
>> We have a lot of solutions:
>>
>> key in dict
>
> new syntax (2.3 and later).
>
So, following it, it can be used for the operations like len?
Bruno Desthuilliers wrote:
>> but what the better
>
> Depends on the context.
>
If know only one context: see if the key are into the dict... What other
context do you know?
Michele
--
http://mail.python.org/mailman/listinfo/python-list
201 - 300 of 1035 matches
Mail list logo