Fredrik Lundh wrote:
> Michele Petrazzo wrote:
>
>>>> key in dict
>>> new syntax (2.3 and later).
>> So, following it, it can be used for the operations like len?
>
> what's "it" in this sentence?
>
It, is the thought that the new 2
rg/doc/2.4.2/tut/node5.html#SECTION00514
and now you have only to wrote it
http://python.org/doc/2.4.2/tut/node9.html#SECTION00920
Michele
--
http://mail.python.org/mailman/listinfo/python-list
André wrote:
> Michele Petrazzo wrote:
>> 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?
>>
>> Mi
add into the new 2.5 for startswith.
I don't know, but can be this feature included into a future python release?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
you _can't_ with python. How you create a .sys/.vxd file? Also that
has only few kb program? And don't such more than few kb memory?
Keep the proxy way or switch to another language :)
> Thanks again. --matthew
>
Michele
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Check out the .translate method and the string.maketrans documentation.
> You can use it to delete a list of characters all in one line:
>
Yes. This is, more or less, what I were looking for.
P.s. Sure, if replace could accept a tuple... :)
Thanks to all
peps/pep-0359 (already rejected by
Guido).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
with
lower-rgb-planar- > 8 and flower-rgb-contig- > 8
IrfanView seem that can load all the images...
> Rob.
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
;__set__'
You need to define the descriptor at the metaclass level too.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
(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
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
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
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
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
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
/2004/pytiff/
>
> Any thoughts?
>
[1] Seem to work. You need "only" some dlls
(http://gnuwin32.sourceforge.net/packages/tiff.htm)
[3] FreeImagePy
> Cheers, Filipe
>
Bye,
MIchele
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
xec")
#do something like this
return_value = comp_code.funct2Call()
But I can't...
I find this:
http://tinyurl.com/nwbpk
but here, it call from the external code a function inside my code. I
want the opposite!
Is there a solution for do this?
Thanks,
Michele
--
http://mail
Michele Petrazzo wrote:
Auto reply:
> I find this: http://tinyurl.com/nwbpk
>
Following this link, here is my solution:
code = """
def funct2Call():
return "It work!"
object.method(funct2Call)
"""
class Object(object):
def method
Peter Otten wrote:
> Michele Petrazzo wrote:
>
>> I want to execute an external code, that become from a text file
>> (pe), call a function inside it and get its return value:
>
> namespace = {} execfile("ext_code.txt", namespace) print
> namespace["func
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).
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
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
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
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
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
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
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
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
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
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
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
--
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
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
http://www.phyast.pitt.edu/~micheles/python/classinitializer.html
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
--
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
ecify the type in add_options, the value aren't passed to the
store_value (into value variable), but it's understood as args!
If I specify it, it
Is this normal?
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
ovide a callback to a new action.
I believe, however, that the doc has to be more explicit about this
strange behavior, because a not so expert dev (like me :) ), can don't
understand at the first time, it.
> STeVe
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
the code written by
others.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
Ivan Voras wrote:
> Is it possible to draw a widget or a window in an off-screen buffer?
(Assuming that you are on linux.)
wxWigets (wxWindows is the old name) or better, since if you are on a
python ng, wxPython :), can't be used if you are on a not-X machine:
michele:~$ env | grep DIS
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
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
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
so). You can see them for study and copy that code (like all do :P ).
Start at wnd.sf.net and freeimagepy.sf.net
>
> Kind regards, Dieter
>
Bye,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
anges from 1.2.0:
New convertToPil function:
i = FreeImagePy.Image("myImage.ext")
pil = i.convetToPil()
Some bugs solved
Michele Petrazzo
--
http://mail.python.org/mailman/listinfo/python-list
l send you the code, so
after we'll a new -open source (do you like wxWidgets license? [LGPL] )-
*Visual Reporting Editior*
>
> Pawel
>
Michele
--
http://mail.python.org/mailman/listinfo/python-list
it into my python fax client [hylapex] that it's
connect to hylafax server.
Of course, It wouldn't be a PIl replacement ;)!
> Claudio
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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
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
hat
is happening.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
stem python outside OOo?
For the first, follow this:
http://udk.openoffice.org/python/python-bridge.html#replacing
for the second:
http://udk.openoffice.org/python/python-bridge.html#modes
> Any hints? Regards, Katja
Michele
--
http://mail.python.org/mailman/listinfo/python-list
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?
---
th, the program
at: http://udk.openoffice.org/python/samples/ooextract.py
work well with a modify:
before the first line "import uno", add:
import sys
sys.path.append("/opt/openoffice.org2.0/program/")
Now, save the program, move it where you want, and go:
michele:~$ python2.
ce...
> Regards, Katja
Michele
--
http://mail.python.org/mailman/listinfo/python-list
print dont_exist
NameError: global name 'dont_exist' is not defined
So all the exception are raised except the KeyError outside the try/except!
I don't know what can be.
Thanks to all that can help me.
Michele
--
http://mail.python.org/mailman/listinfo/python-list
#here I don't see the exeception
>Maybe you don't use dict, but a subclass of it?
All my dict are created as
d = dict()
and populate by: d.update(other_dict) or for k, val in iter: d[k] = val
>
> Diez
Thanks,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
Michele Petrazzo wrote:
> Hi list, I have a strange error on my software on win 2k/xp and
> debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython:
Just for give evidence to my _failed_ tests, my a debugger (eric3), it
see the exception, so it break with a KeyError!
And the same code, no!
Michele Petrazzo wrote:
> Michele Petrazzo wrote:
>> Hi list, I have a strange error on my software on win 2k/xp and
>> debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython:
>
Opss, I forgot some words :)
> Just for give evidence to my _failed_ tests, my a debugger (eric3)
ill be able to help you.
Into my 100 line code, that exception (and all the others) are raised! I
don't able, into all my tries, to reproduce that error on a small code...
I can publish my code, if someone has one hour of spare time and a
postgresql where test the code. I'
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.
ings[_prefixMB + menu_string])
Hope that someone can reproduce this error. I see it on win2k (terminal
usage) and debian (terminal and eric3 )...
py 2.3.5 and wx 2.6
Thanks a lot,
Michele
--
http://mail.python.org/mailman/listinfo/python-list
.. :)
> Can someone point me to a simple example that just shows an icon? I
> don't need it to anything but show up. Any help is appreciated.
Copy and paste that lines into your code and remove the lines that you
don't need. I think that with 15/20 lines you will your taskbar wor
Sion Arrowsmith wrote:
> Michele Petrazzo <[EMAIL PROTECTED]> wrote:
>> some days ago I posted here and say that python "forgot" to raise
>> an exception, but my code was too long for make some tries
>> possible. But now I can reproduce the pro
about the resolution order etc.)
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
> M.E.Farmer:
>Your answer lies somewhere in this page ;)
>http://www.python.org/2.2.2/descrintro.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
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
'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
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
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
http://www.blackbirdblog.it/programmazione/progetti/28
--
Michele Ferretti
ICQ#: 14491159
Skype: m.ferretti79
black DOT bird AT tiscali DOT it
www.blackbirdblog.it
--
http://mail.python.org/mailman/listinfo/python-list
François Pinard wrote:
> [Michele Ferretti]
>
>>http://www.blackbirdblog.it/programmazione/progetti/28
>
>
> Quoted above, the full content of your article. Is it a message? It
> surely does not look like an English sentence.
>
> Should we start a browser each t
iterables too.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
Cappy2112 wrote:
> If you wan't explain what WordPress is, can you at least supply a link
> for a page that's in English?
>
WordPress is most diffused blog engine: http://www.wordpress.org
My library is a client for connect to WP installation.
--
Michele Ferretti
I
Excused all, I have mistaken!
I did not know these rules
the next time I will follow them
Terry Reedy wrote:
> "Michele Ferretti" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> François Pinard wrote:
>
>>[Michele Ferretti]
>>
>>
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
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
[EMAIL PROTECTED] wrote:
> Caro Michele:
>
> Non parlo italiano, ma parlo espagnol. I can read your website, and
> your library looks interesting. Would you like me to provide an
> english translation of your webpage so that you can provide a version
> for english spe
Do you mean setattr?
setattr(A, meth_name, lambda self: type(self))
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
-style
classes and more).
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
an reach the documentation
for that name with a click.
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
301 - 400 of 1035 matches
Mail list logo