nce).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ybe this is just wishful thinking ...
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ard Python.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
y on the childrens, dependending
on their state. Perhaps I would need more information to understand
what
you have in mind.
But at the end my point is "I would not feel much more constrained
in expressivity if I did not have multiple inheritance in Python,
and actually I have found out that th
e "", line 1
dummy = '''
^
SyntaxError: EOF while scanning triple-quoted string
******
Is this a know bug? Any workaround? Thanks for comments,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
sense, actually, but for some reason I would never have
thought
of it (I did not expect doctest to be so smart to strip the dots even
inside a string).
Thanks for the feeback and the quick solution,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
#x27;, '.', '.', '.', '.']
"""
import time, threading
def example():
thread.out = []
while thread.running:
time.sleep(.01)
thread.out.append(".")
thread = threading.Thread(None, example)
if __name__ == "__main
ly cannot understand the reason for such message. Why
it
is so misleading? Can something be done about it?
TIA,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
If you feel it's necessary to let threads spawned by a
> doctest run beyond the time doctest completes, you can arrange to
> invoke DocTestRunner.run() with clear_globs=False.
Perfect, this answers my question and gives me an useful tip about
doctest
globals.
Thanks a lot!
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
1. Mateusz Loskot:
>I would like to ask some scientists or students
>which GUI toolkit they would recommend
>to develop scientific prototypes (for education and
>testing some theories).
My vote is for ipython + matplotlib. Very easy and very powerful.
Michele Simiona
There are also my lectures at Oxford:
http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
quot;site-packages/library/data/")
it work, but I think that is not a good solution (a real pythonic
solution).
Can someone help me?
Thanks
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Michele Petrazzo wrote:
>
>>I want to redistribute the library that I create.
>>I create a project, its setup.py that when launched copy all files into
>>the "site-packages/library" directory. And here it's all ok.
>>Whe
ttr = 1
print s["x"].attr # => 1
s.close()
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
xample;")
#print c.fetchall()
c.close()
if __name__ == "__main__":
conn = sqlite.connect(DBFILE)
writedb(conn)
readdb(conn)
conn.close()
os.remove(DBFILE)
I get UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in
position 3: une
Well, I have used factories of properties external to the class many
times,
and they work pretty well.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
:-(
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
NU GENERAL PUBLIC LICENSE - freeimagepy.sf.net/license-gpl.txt
FIPL: FreeImage Public License - freeimagepy.sf.net/license-fi.tx
More informations can be found here:
http://freeimagepy.sf.net/
Michele Petrazzo
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee ha scritto:
> i noticed that Python uses various logos:
>
Ok, this are not a logo, but better image are this:
http://python.org/pics/PythonIndented_Back.jpg
Michele
--
http://mail.python.org/mailman/listinfo/python-list
ctionCalls
def f():
pass
f()
f()
f()
help(f)
The whole point of the decorator module is that the signature of
the original function is left unchanged (i.e. in this case the
decorated f is still a thunk, not a generic function f(*args, **kw)).
HTH,
Michele Simionato
lo",))
and T("$obj").substitute(obj="hello") give the same output
(this potentially hides type bugs).
So, take this as a bug report if the behavior is not intended and
as a feature request if the current behaviour is the intended
one ;)
Michele Simionato
P.S. at the end, the problem is that string interpolation with
positional arguments is somewhat of a hack, but fixing this will
have to wait until Python 3000 ...
--
http://mail.python.org/mailman/listinfo/python-list
;, "", "", "", "exit"]:
print c.send(cmd)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Ernesto wrote:
> What's the best resource for finding out how to write a wrapper
> module for a shared library file *.so* in Linux?
>
If you have only the .so file, not the source, you can use ctypes.
I work always with it without problems.
Michele
--
http://mail.python.org/ma
eImagePy")
setup(
packages=['FreeImagePy', 'FreeImagePy.test', 'FreeImagePy.tools'],
data_files=[ (prefix, dataToCopy),],
)
How can I modify my script, for make it work with exe package?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
a bit
lacking and you have
to discover many things by trial and errors.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
uot;errors
should never pass silently". May be. You are free to post
the bug report and look at the opinions of the developers. I am happy
enough with the current behavior and I would just
update the docs.
Michele Simionato
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ss me what you want
@type foo: A type
@return: The object
"""
return foo
This not work (MY_VAR is silently skipped), but if I remove:
# -*- coding: utf-8 -*-
it see MY_VAR and put it to my html file.
Is it normal?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
bryan rasmussen wrote:
> Hi
> does anyone have any experience using the Python Image library to
> determine if a Tiff is in the G4 or G3 codec?
PIL don't support G3/G4 encoding.
You can use freeimagepy that is another python graphic package.
Michele (freeimagepy developer
w__"
if you are interested).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Colin:
> It seems to me that __new__ should probably be deprecated for mutable
> classes.
Certainly not! It is useful for mutable classes too. One just must be
careful.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ivalent of the .after() method in pygtk?
BTW, is there any intro to pygtk thought for Tkinter users?
TIA,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
A Singleton class is there to be inherited from; a singleton instance
like the one you define is pretty much useless (unless I misunderstand
your intentions).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
t, as I
> generally don't, it's close to usable.)
FWIW, you can count me about the people who (re)wrote this same thing
(actually with some difference, since I wanted to keep the order, so
I used nested lists instead of nested dictionaries, but the idea was
similar). I would welcome some module in the standard library to store
hierarchical data.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
You were on the right track before: look at the tutor
mailing list ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
okbook for more examples.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
What about bsddb? On most Unix systems it should be
already installed and on Windows it comes with the
ActiveState distribution of Python, so it should fullfill
your requirements.
--
http://mail.python.org/mailman/listinfo/python-list
The documentation hides this fact (I missed that) but actually python
2.3+ ships
with the pybsddb module which has all the functionality you allude too.
Check at the test directory for bsddb.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
s with it.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
What happens if for any reason the application crashes?
Locked files will stay locked or not? And if yes, how do I
unlock them?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
to implement it myself, but maybe I was wrong afterall ...
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ppens in the case of a power failure?
Am I left with locked files floating around?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Ok, I have yet another question: what is the difference
between fcntl.lockf and fcntl.flock? The man page of
my Linux system says that flock is implemented independently
of fcntl, however it does not say if I should use it in preference
over fcntl or not.
Michele Simionato
--
http
ons (remove the setgid bit) before trying to read or write to
it.
Of course, that might be a bit tricky if the system is hung :-(
"""
so lockf locks do not look completely harmless ...
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
standardization in this area.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Just to clarify, before people start pointing out their preferred
templating language: I am NOT asking for
a template system. I am asking for something on the
lines of HTMLGen, where you just use pure Python.
--
http://mail.python.org/mailman/listinfo/python-list
2&x=3&z=&y=4"
print parse_qsl(QS)
print parse_qsl(QS, keep_blank_values=True)
which gives
[('x', '1'), ('y', '2'), ('x', '3'), ('y', '4')]
[('x', '1'), ('y', '2
LTag()
.tableheader = ["field1", "field2"]
.tablebody = [["a1", "a2"],
. ["b1", "b2"]]
.html_header = [html.tr(html.th(el) for el in tableheader)]
.html_table = [html.tr(html.td(el) for el in row) for row in tablebody]
.print html.table(html_header + html_table)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
etween logic and presentation just
putting the
routines generating the HTML pages in a separate module, no need to use
a
different language.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
$ pydoc -g
M.S.
--
http://mail.python.org/mailman/listinfo/python-list
.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
)
finally: # for instance, if CTRL-C is called
counter.stop()
And this is the CGI viewer:
#!/usr/bin/python
import os
print "Content-type: text/plain\n"
print "Counter: %s" % os.environ["COUNTER"]
Pretty bare-bone ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879
--
http://mail.python.org/mailman/listinfo/python-list
Looking at the "calendar" module in the standard library may help.
Also, "pydoc calendar" is your friend.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
origin ...
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
it again so might as well move
it out of
>the way.
+1 for this idea. The summary looks much better now :)
Keep the good work going,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ey_tex
t_to_keyinfo
return keyseq_to_keyinfo(keytext[1:-1])
File "C:\Python24\Lib\site-packages\readline\keysyms.py", line 163,
in keyseq_
to_keyinfo
res.append(char_to_keyinfo(keyseq[0], control, meta, shift))
File "C:\Python24\Lib\site-packages\readline\keysyms.py", line 111,
in char_to
_keyinfo
raise ValueError, 'bad key'
ValueError: bad key
Any hints on what is causing this and the cure?
TIA,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
That line seems right. The function is
def char_to_keyinfo(char, control=False, meta=False, shift=False):
vk = VkKeyScan(ord(char))
if vk & 0x == 0x:
print 'VkKeyScan("%s") = %x' % (char, vk)
raise ValueError, 'bad key'
if vk & 0x100:
shift = True
if vk & 0x200:
con
No, I don't even know how to get it under Windows (usually I use
Linux). Switching to the US keyboard
does not help, anyway. I get the same error.
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Well, this is ugly as the sin but it seems to work, at least for the
moment:
vk = VkKeyScan(ord(char))
if vk == -1: # ugly fix for backtips
vk = 96
I will write to Gary Bishop to point out this issue with the Italian
keyboard and see if he has some decent
solution.
Michele
I asked myself the same question and I am not convinced
that using 'super' with one argument really makes sense
(i.e. IMO it is more a liability than an asset). BTW, I have a set
of notes on the tricky aspects of 'super' you may be interested in.
Michele
super(D, D).f()
D.f()
Just using super(D).f() would not work. ``super`` with only one
argument is
a recipe for headaches.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
define ``__getitem__`` directly, but only
indirectly via delegation (i.e. overriding ``__getattribute__``),
then the second form (i.e. ``type(x).__getitem__(x,y)``) works but
not the first one (i.e. ``x[y]`` raises an error).
Michele Simionato
--
http://mail.python.org/m
t the ACCU conference, so I want to
make
sure I use the rigth terminology.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ere already such links but I missed them).
Would you agree with Leif's definition that iterable is
any x such that iter(x) does not raise an error? On top
of my head I don't find any counter example and it
is the kind of definition I had in mind.
Michele Simionato
--
http
Or, just to impress Lispers,
>>> def add(x,y):
... return x + y
>>> closures = []
>>> for i in range(10):
...closures.append(add.__get__(i))
...
>>> closures[5](1000)
1005
Remember, in Python do not have functions, we have descriptors! ;)
ide the scope).
So this idiom
a = ""
for i in range(10):
if i == 5: a = "5 was reached"
print a
would not work. So, as I said, there are pros and contros.
Personally, I like better the Scheme way (what I do not like
in Scheme is the issue of inner defines vs. tople
> I'm surprised that Michele
>hasn't yet referenced the thread where we exposed the gory details, as
>was his custom for a while :-)
>Message-ID: <[EMAIL PROTECTED]>, for >this particular
>aspect, in case anyone gives a monkey's left testicle.
I had for
But then why he agreed to have the loop variable disappear outside a
generator comprehension?
I think there is something more than a backward compatibility concern.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
s=super(B)
...
>>> help(C)
Traceback (most recent call last):
...
... lots of stuff here
...
File "/usr/lib/python2.4/pydoc.py", line 1290, in docother
chop = maxlen - len(line)
TypeError: unsupported operand type(s) for -: 'type' and 'int'
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Twisted and Zope already use interfaces. You can download
the interface package and use it in you project.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
F. Petitijean:
> ManagerInterface is a module not a class !
Yes, but the error message could be improved (at least for the sake of
people
not knowing the internal working of Python). Do you care to fill a bug
report?
Michele Simionato
--
http://mail.python.org/mailman/listi
Now they use the same interface package. For the other
questions: google is your friend. (try "zope interfaces"
then "twisted interfaces").
--
http://mail.python.org/mailman/listinfo/python-list
.
Just my 2 Eurocents,
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ictionaries
already have lots of methods and I would think twice before adding new
ones; expecially
methods that may turn out not that useful in the long range, or easily
replaceble by
user code.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
mind about a few new functions
in an utility module.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
frameworks.
Depending on your distribution, this may be already available. For instance
in Mandrake 10.1 I just tried
# urpmi python-twisted
and it downloaded twisted 1.3. Seems to work too.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
flush()
write( '\x08' * len(msg) )
time.sleep( self.DELAY )
write( ' ' * len(msg) + '\x08' * len(msg) )
flush()
def stop( self ):
self.running = 0
self.join()
if __name__=="__main__":
it in the standard Popen class. I am surprised
it is not there. Any comments?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
etup)
try: print t.repeat(number=n)
except: t.print_exc()
You can import it with "from timeit_ import timeit" and it gives you access to
your __main__ program namespace.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
table of contents,
indices, etc. Conversions to many formats (Latex, DocBook, etc.) would be
welcome. Does something like that already exists? Alternatively, I would need
some hierarchical Wiki with the ability of printing its contents in an
structured way.
Michele Simionato
--
http
here:
www.unipex.it/vario/RealPyOdbc.py
In the future, when I'll finish it (make the db-api 2), I'll open a
sf.net project.
I hope it will help you.
Bye,
Michele Petrazzo
--
http://mail.python.org/mailman/listinfo/python-list
or example, if the pc is
lighted, but no logged-in, pycron don't work!
Why don't add this function? I think that is simple to make with py2exe
help.
If you want I can create a simple GUI that can help the users that have
no knowledge whit contrab sintax.
Michele
--
http://mail.python.org/mailman/listinfo/python-list
. For now it is not
db-api 2 compatible, but I use it in production and have no problems.
You can try it here:
www.unipex.it/vario/RealPyOdbc.py
Of course, if you want to help me to make it db-api 2 compatible, you
are welcome!
Michele
--
http://mail.python.org/mailman/listinfo/python-list
self.setdefault(key, defaultfactory())
return defdict
d = defaultdict(int)()
d["x"] += 1
d["x"] += 1
d["y"] += 1
print d
d = defaultdict(list)()
d["x"].append(1)
d["x"].append(2)
d["y"].append(1)
print d
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I am not sure how safe it is, but on Linux I have just copied
subprocess.py
in my 2.3 installation and it worked in all the cases I tried.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
w I have forgot nearly everything ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I think you may find Alex Martelli's PyCon slides somewhere
on the net. The black magic slides discuss this issue. But I
think the fix he suggests is not dissimilar from what you
are already doing. I don't remember exactly now, but
it is always worth a look.
Michele Simionato
ass
if there is a real need for it.
Paraphrasing Occam, I would say "don't multiply base classes without
necessity" ;)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
d setters and making properties from them).
I typically use a property factory function, or a custom descriptor.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
This is spectacular! :)
Is there a way to make it to work from environments (such as emacs)
where stdin is special?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Just give (as root)
# urpmi python-devel
(assuming you have configured urpmi properly, Google
for "easy urpmi").
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Michael Spencer:
> Alternatively, you could provide factory functions to construct the
defaultdict.
> Someone (Michele?) recently posted an implementation of this
Yes, here is the link for the ones who missed that thread:
http://groups-beta.google.com/group/comp.lang.python/browse_frm/
defaultdict.__init__ you would just call dict.__init__
and not thirdpartdict.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Not to be rude, but you are on the wrong list and your question is ill
formulated:
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.zope.org/Resources/MailingLists
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
ing with CLOS classes, which are pretty
slim, since the (multi)methods are defined outside
them?
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
I have realized today that defining decorators for functions
with generic signatures is pretty non-trivial.
Consider for instance this typical code:
#
def traced_function(f):
def newf(*args, **kw):
print "calling %s with args %s, %s" % (f.__name__, args, kw)
return f(*args, *
I said it was very little tested! ;)
This should work better:
#
def _signature_gen(varnames, n_default_args, n_args,
rm_defaults=False):
n_non_default_args = n_args - n_default_args
non_default_names = varnames[:n_non_default_args]
default_names = varnames[n_non_default_args:n_args]
Yes, this is essentially the same idea. You compile the codestring to
bytecode,
whereas I just evalue the codestring to a lambda function. We are
essentially implementing a runtime macro by hand. I wonder if there is
any alternative
approach to get the same result, without manipulation of the sourc
:
def __init__(self):
print "C2.__init__"
class D(C1, C2):
def __init__(self):
print "D.__init__"
D()
# you get
# B.__init__
# C2.__init__
# C1.__init__
# D.__init__
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
101 - 200 of 1035 matches
Mail list logo