pper and use that instead.
my_escape = lambda st: cgi.escape(st, 1)
So. Lawrence is happy, and the escape works as expected. Several man
years has been saved.
Max M
--
http://mail.python.org/mailman/listinfo/python-list
stuff.
If you cannot think of other examples for yourself where your change
would introduce breakage, you are certainly not an experienced enough
programmer to suggest changes in the standard lib!
Max M
--
http://mail.python.org/mailman/listinfo/python-list
content = f.read()
f.close()
return '"%s"' % someword in content:
You might think that it is stupid code that should be changed to take
escaped quotes into account. But that is really not your bussines to
decide if the other behaviour is documented and correct.
walterbyrd skrev:
> If so, I doubt there are many.
>
> I wonder why that is?
Because you are ignorant?
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro skrev:
> In message <[EMAIL PROTECTED]>, Gabriel G
> wrote:
>
>> At Monday 25/9/2006 11:08, Jon Ribbens wrote:
>>
> What precisely do you think it would "break"?
existing code, and existing tests.
>>> I'm sorry, that's not good enough. How, precisely, would it break
>>
rrently /underrated/ in the Python community. Or,
> I suspect, everybody disrespects them in public but secretly use them when
> they're hacking ;-)
When I used to program in Perl I used regex' for lots of stuff. In
python I probably use them once every half year.
Bernard skrev:
> Has anyone tried what I'm doing? and if you tried how have you
> succeeded getting the data back after the post action?
Most likely you get assigned a cookie that you then need to return.
Try the cookielib which automates all this for you.
--
http://mail.python.org/mailman/list
irst string
Why offcourse? But it seems that you are passing the Header object a
utf-8 encoded string, not a latin-1 encoded.
You are telling the header the encoding. Not asking it to encode.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
Christoph Haas skrev:
> On Thursday 23 November 2006 16:31, Max M wrote:
>> Christoph Haas skrev:
>>> Hello, everyone...
>>>
>>> I'm trying to send an email to people with non-ASCII characters in
>>> their names. A recpient's address
;
>>> x = 111
>>> x = (x /4) * 4
X *= 4
;-)
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
ttp://www.google.dk/search?q=python+icalendar
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
iler written
> in python?
This also requires Plone, so it might be a bit heavyweight for your needs:
http://www.mxm.dk/products/public/mxmImapClient/
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
py
Make a Zope instance with Python24\Scripts\mkzopeinstance.bat
Start that instance by running
/bin/runzope.bat
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
thon to be called
> oMail.send()
> gwApp.quit()
Otherwise you are just adressing the objects
eg. this is perfectly ok:
send = oMail.send
send()
or
q = gwApp.quit
q()
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
ing something like..
>
> x = open("abc.jpg")
> y = x.read()
> tmp = open("newFile.jpg", "w")
> tmp.write(y)
> tmp.close()
> x.close()
>
> ...but that doesn't give me a copy of abc.jpg
>
> any ideas? Thanks
>
x = open("abc
master">
>
>
>
> HERE IS MY DYNAMIC PHP:
>
>
>
>
>
> I need to use DTML instead of ZPT because PHPParse product cannot work with
> ZPT. :(
Just an idea, cant you put the PHP into a dtml method that you the
omething like that. And if somebody knows the language he speaks, then
>>a pointer to an appropiate list would be usefull.
As far as I know, there is no rule that you have to use english in this
forum. But it is a lot easier to get answers if you do.
--
hilsen/regards Max M, De
Fredrik Lundh wrote:
> (I just noticed that there's no euro sign on my swedish keyboard. I've
> never missed it ;-)
It's probably "AltGR + E" like here in DK
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> depending on the data, it might be more efficient to store the
> "last seen index" in a dictionary, and sort the result on the way
> out (if necessary). something like
form sets import Set
data = list(Set([0.1,0.5,0.6,0.4,0.1,0.5,0.6,0.9]))
--
h
Fredrik Lundh wrote:
> Max M wrote:
>
>
>>>depending on the data, it might be more efficient to store the
>>>"last seen index" in a dictionary, and sort the result on the way
>>>out (if necessary). something like
>>
>>form sets import
already gone through MimeWriter,smtplib and so
> on. But I can't get clear details. so if anyone know
> regarding this kindly give me answer
You need the 'email' module for reading and writing email messages, and
the 'smtplib' module for sending them.
--
hilsen
2005, 1, 1, 9, 0, 0), datetime(2005, 1, 1, 14, 0, 0)))
ms.add((datetime(2005, 1, 1, 12, 0, 0), datetime(2005, 1, 1, 17, 0,
0)))
print ms.spans
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
with regards to size of "search
window" and number of events.
Bengts/Jims and Jordans solutions seems to be relatively similar. I will
use one of those instead of my own code.
Thanks!
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.pyth
[EMAIL PROTECTED] wrote:
I want to use it for music. So given list 1 (melody), list 2 (chords)
could be generated by a Markov chain. Also, given the chords the melody
could be generated again by a chain.
I have this small module, that can be used for markov chains.
--
hilsen/regards Max M
lf to a could have made it obvious:
def __add__(self, b):
a = self
return Vector((a.x+b.x), (a.y+b.y), (a.z+b.z))
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
Aahz wrote:
> [posted & e-mailed]
> Any objection to swiping this for the FAQ? (Probably with some minor
> edits.)
I think it is missing the most important reason, that functions can act
as unbound methods.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Ma
nt to export from, you only need to
write an external method in Zope to export the data you want. Its pretty
easy that way.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
;
> I get h : ['Helo\n', 'World']
>
> I thought notepad use \r\n to to end the line.
>
> What's wrong with it?
Python tries to be clever. Open it in binary mode to avoid it:
FName = open(d:\myfile.txt,'rb')
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
oured with python and had
> better develop an arsenal of tricks for the rare times when it's just
> not fast enough.
A dash of c combined integrated via ctypes is probably the easiest solution?
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http:/
at all.
Just inefficient xpath expressions.
That is pretty good in my book.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
lieve that would be more difficult than necessary. The client
> program I have to use does not support FTP.
Try out urllib2
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
ns: [53.0, 20.0, 4.0, 2.0]
The lambda is not needed there, as float is a callable.
map(float, str.split(','))
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
ashish skrev:
> Hi All,
>
> I want to know weather is there any api available in python for parsing
> xml(XML parser)
I have had very good succes with lxml
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
sages just because the
sentbox isn't set correctly
pass
#
# returns a portal status message
if REQUEST:
if success:
message = 'Succes! The message was sent '
else:
message = 'Error! The message could not be sent'
REQUEST.RESPONSE.redirect(self.absolute_url() +
'/mxmImapClient_compose?portal_status_message=%s' % message)
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
xample.html
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
t.com/2008/03/python-unicode-lessons-from-school-of.html
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
This looks great. I have been missing my chm based docs since moving to
Python. This goes a long way.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
/usr/src'
for a in ['dictFoo','dictBar','dictFrotz']:
if not 'srcdir' in a:
a['srcdir'] = '/usr/src'
for a in ['dictFoo','dictBar','dictFrotz']:
a.setdefault('srcdir') = '/usr/src'
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
John Machin skrev:
> On Apr 4, 9:44 am, Max M <[EMAIL PROTECTED]> wrote:
> Ummm ... excessive apostrophes plus bonus gross syntax error, dood.
> Did you try running any of these snippets???
No I just wanted to quickly show different ways to do it.
The dicts in the original
mply gone quiet.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
a feel for the
language.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
e c family of languages where there is a lot more algorithms
due to the low level coding. Memory handling, list, dicts etc. qickly
becomes more like math algorithms than in Python.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
e dict of functions is a bit safer. You don't risk calling a built in
method on your object . Which you risk doing with something like:
getattr(obj, 'join')
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
note: What you will be doing is a variation of the factory
pattern.
So this search might give you some new ideas:
http://www.google.dk/search?hl=en&q=python+factory+pattern
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
0, 0, 0, 33, 249, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1, 0,
1, 0,
0, 2, 2, 68, 1, 0, 59]
if not transparent:
template[13:16] = self.bytes() # set rgb values
template[22] = 0 # remove transparency
return ''.join(map(chr, template))
if __name__==
Perhaps csound can help with this. It has a lot of midi, realtime and
python stuff.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
it on Windows and I found it to be a bore to get real
time midi working.
It would probably be easier now that I am on Linux.
Well I just thought I would mention that it is not dead. Merely middle aged.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://ma
ace. Just use:
"easy_install zope.interface"
And you have interfaces.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
ut Python
being broken.
You will probably get better responses if you just state that there are
things you do not understand, and ask why it works that way.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
projecktzero wrote:
> I think the new site is great. I really don't understand all the nit
> picking that's going on from the armchair web designers.
It's a nice site. It is not ugly, and its easy to navigate.
*much* better than the old site,
--
hilsen/regards
Comparing:
http://www.python.org/
http://www.perl.org/
http://www.java.org/
http://www.ruby-lang.org/en/
http://java.sun.com/
http://www.php.net/
It is pretty easy to see that http://www.python.org/ is both prettier
than the rest, and has a far better structure.
--
hilsen/regards Max M
It is hard to tell what you are trying to do here. But here is a shot at
parts of the code.
class Foo:
def __init__(self, x):
self.x = x
y = [Foo(10.0), Foo(110.0), Foo(60.0)]
x_values = [o.x for o in y]
y_max = max(x_values)
y_min = min(x_values)
Otherwise you could try and describ
ame I think. Testing should tell you which is
faster in your case.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
udioVideoRecording/HomePage
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
--
http://mail.python.org/mailman/listinfo/python-list
lkFlags - audio-yes):
http://us.pycon.org/zope/talks/talksRoster?year%3Alist=&day%3Alist=&track%3Alist=&title=&authors=&abstract=&flags%3Alist=audio-yes&order=Sequence
Then most presentations with audio has several audio formats you can
download.
--
hilsen/regards
John Salerno wrote:
> Max M wrote:
>
>> abcd wrote:
>>
>>> well actually, the site looked promising...only problem is no talks
>>> have audio, video or handouts available (at least right now).
>>>
>>> oh well.
>>>
>>
>&
;key2'] = 'value 2'
>>> a_hash_is_a_dict['key']
'value'
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
--
http://mail.python.org/mailman/listinfo/python-list
es are bad in programming, whay are they good in
general communication.
"Python Packages" is too obvious perhaps?
When we start using eggs will it then be renamed to "Dairy Shop" or
perhaps "Daisy" to make it obscure? Or the "Chickens Nest"?
Please. If it is
Raja Raman Sundararajan wrote:
> I was wondering if there was any library as reportlab to generate word
> documents.
If you are on Windows, why dont you use word for it? You can call it
from Python.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +
2003, 00:49:11)
>>
>>generator comprehensions are new in 2.4. Try:
>>
>> self._all_states |= set([key[i] for key in probabilities])
>
>
> And sets aren't a builtin in 2.3
>
> try:
> set()
> except NameError:
> import sets
> set = set
ey combine two brilliant ideas that are hard to do in practice.
"Testing" and "Literate Programming"
In the process it even manages to make both a lot easier.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
--
http://mail.python.org/mailman/listinfo/python-list
t;> 100+1 is 101
False
They don't have the same id. (Think of id as memory adresses.)
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
--
http://mail.python.org/mailman/listinfo/python-list
unction:
def somefunc(val=None):
if val is None:
val = []
do_stuff(val)
Or if None is a possible parameter you can use your own object as a marker::
_marker = []
def somefunc(val=_marker):
if val is marker:
val = []
do_stuff(val)
--
hilsen/regards M
lly don't want to calculate it by myself :-))
It is application specific. So how *do* you want
one-month-ago(31.mar.2006) or one-month-ago(28.feb.2006) to work? No one
can know but you.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
--
http://mail.python.org/mailman/listinfo/python-list
I urged a friend from Boeing to use python on a personal project. He liked it
and repeatedly urged a Boeing developer to use it. Python is on the list of
approved languages at Boeing. The developer wrote a thousand line enterprise
level program in Python. He reports that it would have take t
101 - 166 of 166 matches
Mail list logo