Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-05 Thread Max M
code('utf-8') >>u'INBOX' Tn that case id.decode('hex') doesn't return a unicode, but a utf-8 encoded string. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: smtp question

2005-01-05 Thread Max M
t;> msg.set_payload(body) Thats all. Though some smtp servers needs a Date header too, to work. >>> from time import gmtime, strftime >>> msg['Date'] = strftime("%a, %d %b %Y %H:%M:%S +", gmtime()) Sending the message via the smtp module is even simpler. >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail(fromaddr, [to], msg.as_string()) >>> server.quit() -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Returning same type as self for arithmetic in subclasses

2005-01-07 Thread Max M
thods? """ from datetime import datetime, timedelta class myDatetime(datetime): pass class myTimedelta(timedelta): pass if __name__ == "__main__": import os.path, doctest, dtime # import and test this file doctest.testmod(dtime) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning same type as self for arithmetic in subclasses

2005-01-08 Thread Max M
))) except: raise ValueError, 'Wrong format' return vDatetime(*timetuple) fromstring = staticmethod(fromstring) def __str__(self): return self.strftime("%Y%m%dT%H%M%S") -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Another look at language comparisons

2005-01-08 Thread Max M
Jan Dries wrote: [EMAIL PROTECTED] wrote: And there is hope for Python, as Guido has recently been seen with a beard :-) http://www.tbray.org/ongoing/When/200x/2004/12/08/-big/IMG_3061.jpg LOL, he is working on linux, isn't he? So it was about bloody time. -- hilsen/regards Max M, Denmark

Re: Weekly Python Patch/Bug Summary

2005-01-08 Thread Max M
Kurt B. Kaiser wrote: Remove witty comment in pydoc.py (2005-01-01) CLOSED http://python.org/sf/1094007 opened by Reinhold Birkenfeld This is not a joke? :-) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

oddities in the datetime module

2005-01-14 Thread Max M
etimetuple) class date2(date): def datetimetuple(self): return self.timetuple()[:6] + (0, None) def from_datetimetuple(dt_tuple): return date2(*dt_tuple[:3]) from_datetimetuple = staticmethod(from_datetimetuple) #from datetime import datetime # #ical = Calendar() #print ical.ical() if

Re: oddities in the datetime module

2005-01-14 Thread Max M
Serge Orlov wrote: Max M wrote: Yes, you did. datetime.timetuple is those who want *time module* format, you should use datetime.data, datetime.time, datetime.year and so on... As they say, if the only tool you have is timetuple, everything looks like tuple Try this: dt = datetime(2005, 1, 1

[ANN] iCalendar package 0.9

2005-01-17 Thread Max M
Api is pretty stable, and will probably not change much. I would like anybody interrested to give it a test drive before I finish it off and make it a 1.0. http://www.mxm.dk/products/public/ical/ Any feedback would be welcome. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Sc

Re: [ANN] iCalendar package 0.9

2005-01-18 Thread Max M
Roger Binns wrote: "Max M" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] http://www.mxm.dk/products/public/ical/ Any feedback would be welcome. How well do you cope with the crud that real programs generate? Does it work with the different dialects uses out there?

Re: find isset() php function equivalent in python

2005-02-01 Thread Max M
bad practice to do it like that. If you need variables that you don't know that name of, you should put them in a dictionary. They are made for that exact purpose. >>> unkown_vars = {} >>> unkown_vars['variable'] = 42 >>> 'variable' in unkown

Re: Remove HTML tags (except anchor tag) from a string using regular expressions

2005-02-01 Thread Max M
Nico Grubert wrote: If it's not to learn, and you simply want it to work, try out this library: http://zope.org/Members/chrisw/StripOGram/readme -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread Max M
g cookie in your file? Try adding this as the first or second line. # -*- coding: cp850 -*- Python will then know how your file is encoded -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Boss wants me to program

2005-06-28 Thread Max M
ll not be as > mysterious or dangerous. I agree. The language is more important than the gui. It is not very hard to make good applikations in eg. Tkinter, and you will understand evey part of it. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.

Re: Modules for inclusion in standard library?

2005-07-01 Thread Max M
gestion to start with. ctypes certainly. Even though it can crash Python. People using ctypes would be aware of this. Another good bet is BeautifulSoup, which is absolutely great for scraping content from webpages. http://crummy.com/software/BeautifulSoup/index.html -- hilsen/regards

Re: What are the other options against Zope?

2005-07-04 Thread Max M
objects can then be called eg. from a web browser with different parameters. But you can also use other protocols than http like dav, ftp etc. This is a very effective way to build web applications, and does not need sql-object remapping as normal web apps does. -- hilsen/regards Max

Re: f*cking re module

2005-07-04 Thread Max M
rom a reference! If you want to try out re interactively you could use: \Tools\Scripts\redemo.py -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: mail sending using telnet in python

2005-07-08 Thread Max M
on but I cann't > get solution for it. Why not just use the smtp module? It's a tad easier. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: UCALC equivalent

2005-08-12 Thread Max Erickson
Scott David Daniels <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > max wrote: >> Larry Bates <[EMAIL PROTECTED]> wrote in >> news:[EMAIL PROTECTED]: >>>Python has built in eval function and doesn't require a library. >> >> Are you

Re: A PIL Question

2005-08-14 Thread Max Erickson
uments. You can get those from your original image... >>> from PIL import Image (skip me loading an image into im) >>> im >>> im.mode 'RGB' >>> im.size (510, 800) >>> im2=Image.new(im.mode,im.size) >>> seq=im.getdata() >>&g

stdin -> stdout

2005-08-19 Thread max(01)*
at', *sigh*! bye max ps: in perl you ca do this: ... while ($line = ) { print STDOUT ("$line"); } ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating watermark with transparency on jpeg using PIL?

2005-08-20 Thread Max Erickson
gt; draw=ImageDraw.Draw(wm) >>> draw.text((0,0),'Watermark',(0,0,0),font) >>> wm.show() >>> en=ImageEnhance.Brightness(wm) >>> mask=en.enhance(0.5) >>> im.paste(wm,(25,25),mask) >>> im.show() >>> Here, the alpha channel of 'mask' is used as the mask. max -- http://mail.python.org/mailman/listinfo/python-list

regular expressions use

2005-08-22 Thread max(01)*
t be made easily or more compactly? i am a python regexp novice. bye max ps: i was trying to pythonate this kind of perl code: $riga =~ s/%([A-Fa-f0-9][A-Fa-f0-9])/chr(hex($1))/ge; -- http://mail.python.org/mailman/listinfo/python-list

pipes like perl

2005-08-23 Thread max(01)*
y exception even if *some_system_command* does not exist/work... any help? thanks a lot max -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes like perl

2005-08-23 Thread max(01)*
bruno modulix wrote: > max(01)* wrote: > >>hi. > > > (snip) > > >>it doesn't work, since "*do_something*" and *do_something_more* are >>always executed (it seems like >> >>MYPIPE = os.popen("*some_system_command*", &

Re: pipes like perl

2005-08-23 Thread max(01)*
"*some_system_command*", "r") if not CMD_STDERR.readlines(): ... *do_something* ... for answer in CMD_STDOUT: print answer, ... *do_something_more* ... else: ... *do_something_else* ... CMD_STDIN.close() CMD_STDOUT.close() CMD_STDERR.close() bye max -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes like perl

2005-08-23 Thread max(01)*
max(01)* wrote: > infidel wrote: > >> Here's one technique I use to run an external command in a particular >> module: >> >> stdin, stdout, stderr = os.popen3(cmd) >> stdin.close() >> results = stdout.readline

Re: pipes like perl

2005-08-25 Thread max(01)*
many thanks to all the fellows who cared to answer! bye max -- http://mail.python.org/mailman/listinfo/python-list

Re: Unix diff command under Window.

2005-08-25 Thread Max M
TonyHa wrote: > Hello, > > Does any one have using Python to write a Unix "diff" command for > Window? I generally just us the diff built into tortoiseSVN. That way it's only a rightclick away. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Sc

Re: Excel Character object through COM

2005-08-26 Thread Max Erickson
> > So my question is that am I doing something wrong or there is a > different way to modify the color of a charater through COM. > try GetCharacters(1,1) max -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic image creation for the web...

2005-08-28 Thread Max Erickson
/bitworking.org/projects/sparklines/ It is a script very similar to what you want to do. The difference between your script and sparklines is mostly that it sends: print "Content-type: image/png" instead of: print 'Content-type: text/html' max -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: PyDev 0.9.8 released

2005-08-30 Thread Max M
ing to it, I just wondered what experiences other users might have when using it for production. Being that my text editing environment is my bread and butter. Is it stable/effective etc? Anybody cares to share? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science --

Re: ANN: PyDev 0.9.8 released

2005-08-30 Thread Max M
Fabio Zadrozny wrote: > Hi Max, > > I may be a little (or maybe a lot) biased for it (as I'm its > maintainer), but as I do 'eat my own dogfood', I though I might share it > with you... Enthusiasm doesn't disqualify ;-) > At my company, everybody that

named pipe input

2005-09-01 Thread max(01)*
hi there. i have some problems understanding following behaviour. consider this: ... $ cat file_input_3.pl #!/usr/bin/perl open MIAPIPE, "una_pipe"; while ($riga = ) { print STDOUT ("$riga"); } $ cat file_input_3.py #!/usr/bin/python import sys MIAPIPE = open("una_pipe", "r") fo

Re: named pipe input

2005-09-01 Thread max(01)*
Eric Nieuwland wrote: > max(01)* wrote: > >> $ cat file_input_3.py >> #!/usr/bin/python >> >> import sys >> >> MIAPIPE = open("una_pipe", "r") >> >> for riga in MIAPIPE: >>print riga, >> ... >> [...]

Re: is dict.copy() a deep copy or a shallow copy

2005-09-04 Thread Max Erickson
t D.copy() > returns a shallow copy of D, or did I misunderstand the > difference between a deep and shallow copy? Sort of, some examples: Here d1 and d2 are copies. They can be independently changed to refer to different objects: >>> d1={'a':1,'b':2} >>> d2=d1.copy() >>> d1['a']=3 >>> d2['b']=4 >>> d1 {'a': 3, 'b': 2} >>> d2 {'a': 1, 'b': 4} Again, d3 and d4 are copies, but instead of changing the objects they refer to, we change the contents of the objects they refer to: >>> d3={'c':[3],'d':[4]} >>> d4=d3.copy() >>> d3['c'][0]=5 >>> d4['d'][0]=6 >>> d3 {'c': [5], 'd': [6]} >>> d4 {'c': [5], 'd': [6]} Both cases are shallow copies. In a deep copy, altering the contents of d3['c'] would have no impact on the contents of d4['c']. max -- http://mail.python.org/mailman/listinfo/python-list

Newbie: Datetime, "Prog. in Win32", and how Python thinks

2005-09-05 Thread Max Yaffe
grepped for datetime in the library & found plenty of references to it but no module definition. Where is it defined? 4) How does the python interpreter resolve the statement "import datatime"? Thanks, Max Code don't lie. Manuals Lie. I'm highly suspicious of browsers. -- http://mail.python.org/mailman/listinfo/python-list

Re: nested tuples

2005-09-09 Thread Max Erickson
(row1value1, row1value2, > row1value3),(row2value1, row2value2, row2value3),..., > (rowNvalue1, rowNvalue2, rowNvalue3)] tuple() will consume a list. >>> tuple([1,2,3]) (1, 2, 3) >>> tuple([(1,2),(3,4),(5,6)]) ((1, 2), (3, 4), (5, 6)) max -- http://mail.python.org/mailman/listinfo/python-list

Re: brain cramp: emulating cgi.FieldStorage

2005-09-15 Thread Max M
blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored.

Re: IDE, widget library

2005-09-16 Thread Max M
ob on pydev! -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary to file

2005-09-16 Thread Max M
and save that to a file. http://docs.python.org/lib/module-pickle.html -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: C#3.0 and lambdas

2005-09-19 Thread Max M
s it would normally look: def func(*arg) That should work just as well for those cases. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: web scrapping - POST and auto-login

2005-09-19 Thread Max Erickson
you've got any ideas. strings are slicable: >>> s='a string of characters' >>> s[:10] 'a string o' >>> s[-10:] 'characters' >>> As far as your other problem, it might make sense(I don't know...) to just gener

Re: web scrapping - POST and auto-login

2005-09-19 Thread Max Erickson
"james hal-pc.org" wrote in news:[EMAIL PROTECTED]: > Max Erickson wrote: >>>>the entire 26 character string from site A, but [1] how do i >>>>crop it to 10 characters. >> >> strings are slicable: > > The only reason i've gotten this

Re: Replacing an XML element?

2005-09-20 Thread Max Erickson
Nick Vargish <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I've been trying to figure out how to do something that seems > relatively simple, but it's just not coming together for me. I'm > hoping someone will deign to give me a little insight here. > > The problem: We have XML document

Re: How to use writelines to append new lines to an existing file

2005-09-22 Thread Max Erickson
27; > > > Does f = open('/tmp/myfile', 'w') overwrite the existing file > or does f.writelines('456') replace the first line in the > existing file? > > Nico There is a good explanation in the tutorial: http://docs.python.org/tut/node9.html#SECTION00920 and more detail is available in the docs for builtin functions: http://docs.python.org/lib/built-in-funcs.html (look under file() but probably still use open()) That said, open(file, 'a') will open an existing file to append. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from unicode to int

2005-09-22 Thread Max M
Tor Erik Sønvisen wrote: > Hi > > Is there any simpler way to convert a unicode numeric to an int than: > > int(u'1024'.encode('ascii')) why doesn't: int(u'104') work for you? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ I

Re: Is Python as capable as Perl for sysadmin work?

2005-02-08 Thread Max M
x27;t work. You have to suggest that it 'try ... except', which is really offensive. If I want to beg my computer to run programs, I know where to find Intercal with its "PLEASE" and "DO PLEASE" constructions. Wasn't there talk about a "try harder" recently

Re: Big development in the GUI realm

2005-02-11 Thread Max M
developing something like a desktop application that you want to sell for money, using the GPL is a bad idea. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Max M
7; Is this really that hard to do, that you want it in the library? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk()

2005-02-17 Thread Max Erickson
ist() >>> for r, ds, fs in os.walk('c:\\bin\\gtest'): keptfiles.extend(fs) keptdirs.extend(ds) >>> keptfiles ['P4064013.JPG', 'P4064015.JPG', 'Thumbs.db', 'P4064026.JPG', 'Thumbs.db', 'Thum

Re: tiff via email-module

2005-02-17 Thread Max M
.append(part.get_payload(decode=1)) return attachments return [] -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy functio in imaplib

2005-02-22 Thread Max M
a string. In one of the forms: '1,2,3,4' or '1:4' The numbers can be either message sequence numbers or uids. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux & Windows XP

2005-02-22 Thread Max M
g an encoding: ust = unicode(st) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Max M
able. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Re: python-dev Summary for 2005-01-16 through 2005-01-31

2005-03-02 Thread Max M
hared effort" in the single sub-project, it might very well be on a higher level. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Wishful thinking : unix to windows script?

2005-03-04 Thread Max Erickson
you might also want to take a look at http://unxutils.sourceforge.net/ where are the tools are available in a single zip file. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to make a list unique?

2005-03-08 Thread Max M
can be a little simpler: listA = list(Set(listA)) You don't even need to convert it to a list. You can just iterate over the set. >>> la = [1,2,3,4,3,2,3,4,5] >>> from sets import Set >>> sa = Set(la) >>> for itm in sa: ... print itm 1 2 3

Re: function namespaces

2005-03-08 Thread Max Erickson
filename): ns=dict() execfile(filename, ns) print ns['testvar'] should at least get you going. There is probably a way to pass the namespace of the function to execfile, but I do not know it. max -- http://mail.python.org/mailman/listinfo/python-list

Re: split a string with quoted parts into list

2005-03-10 Thread Max M
ted sub entries into a list of strings? In Twisteds protocols/imap4.py module there is a function called parseNestedParens() that can be ripped out of the module. I have used it for another project and put it into this attachment. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad S

Re: csv module and unicode, when or workaround?

2005-03-12 Thread Max M
x27;t support unicode, but you should not have problem importing/exporting encoded strings. I have imported utf-8 encoded string with no trouble. But I might just have been lucky that they are inside the latin-1 range? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Scien

Re: Linux Multimedia System

2005-03-13 Thread Max Erickson
to check out freevo at http://freevo.sourceforge.net/ as it is quite similar to what you are describing and they are quite far along. max -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-15 Thread Max M
Gregor Horvath wrote: thanks are given to all "problem" solved... Personally I add a , after every list/tuple item. Also the last. It also makes copy/pasting code easier. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/

IMAP UTF-7, any codec for that anywhere?

2004-12-01 Thread Max M
Convention -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: IMAP UTF-7, any codec for that anywhere?

2004-12-01 Thread Max M
Brian Quinlan wrote: > Max M wrote: > >> Is there any codec available for handling The special UTF-7 codec for >> IMAP? > Is there something special do you need or is recipe OK? > > >>> u"\u00ff".encode('utf-7') > '+AP8-' A

Re: Need help on program!!!

2004-12-03 Thread Max M
dice1, dice2 = rolldice() roll += 1 if dice1 + dice2 == 7: print 'Too bad, you loose in roll %s' % roll result = None elif (dice1, dice2) == (first1, first2): print 'Congratulations, you win in roll %s' % roll result = None Hopefully h

Re: Need help on program!!!

2004-12-03 Thread Max M
Dan Perl wrote: "Max M" <[EMAIL PROTECTED]> wrote in message Most of us here have been students (or still are) and may sympathize with the OP, but personally I have been also a TA so I have seen the other side and that's where my sympathy lies now. My reply was a joke... M

Re: Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Max M
://initd.org/projects/psycopg1 Postgres runs fine on Windows now in a native version. And pgAdmin is a pretty nice tool. A precompiled psycopg is the missing link. Thanks. I will try it out. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/ma

Re: Persistent objects

2004-12-12 Thread Max M
app and restart it later, there'd be a way to bring d back into the process and have that Frob instance be there. Have you considdered using the standalone ZODB from Zope? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: do you master list comprehensions?

2004-12-13 Thread Max M
u might be more comfortable with: data = [['foo','bar','baz'],['my','your'],['holy','grail']] result = [] for l in data: result += l -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: do you master list comprehensions?

2004-12-13 Thread Max M
Fredrik Lundh wrote: Max M wrote: I tried funnies like [[w for w in L] for L in data], That is absolutely correct. It's not a funnie at all. well, syntactically correct or not, it doesn't do what he want... Doh! *I* might not be used to list comprehensions then... You are right. Th

Re: Help need with converting Hex string to IEEE format float

2004-12-14 Thread Max M
nd stuff. You should get tons of answers. ## st = '80 00 00 00' import binascii import struct s = ''.join([binascii.a2b_hex(s) for s in st.split()]) v = struct.unpack("f", s)[0] print v ## regards Max M -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: python re - a not needed

2004-12-16 Thread Max M
ftware/BeautifulSoup/ I will most likely do what you want in 2 or 3 lines of code. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are tuples immutable?

2004-12-16 Thread Max M
t the time taken to convert a list into a tuple. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: character encoding conversion

2004-12-13 Thread Max M
return st_encoded, encoding except UnicodeError: pass st = 'Test characters æøå ÆØÅ' encodings = ['utf-8', 'latin-1', 'ascii', ] print get_encoded(st, encodings) (u'Test characters \xe6\xf8\xe5 \xc6\xd8\xc5', '

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Max M
using those email adresse, or you don't log on with the correct credentials. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good use for lambda

2004-12-20 Thread Max M
The entity Fredrik Lundh wrote: Isn't it about time you became xml avare, and changed that to: ? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good use for lambda

2004-12-20 Thread Max M
Steve Holden wrote: Max M wrote: Isn't it about time you became xml avare, and changed that to: Yeah, but give the guy a break, we've all made feeble attempts at humor from time to time. Hey, what's wrong with a little nørd humor... I just found it amusing that somenone like Fred

Re: Python To Send Emails Via Outlook Express

2004-12-20 Thread Max M
to find those than it is to use them as the sender. Most email clients can fetch the settings from other mail clients, so it's been done before. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: MIDI library recommendations, please?

2004-12-20 Thread Max M
project which does that on different platforms. But I am not aware how well they work. The best place to ask is probably on the Python Midi list at: http://sourceforge.net/mail/?group_id=113783 -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/ma

Re: Python To Send Emails Via Outlook Express

2004-12-24 Thread Max M
len(RecipWork) # Formulate the recipients MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) rda = MapiRecipDesc_A() for rd, ra in zip(rda, RecipWork): rd.ulReserved = 0 rd.ulRecipClass = MAPI_TO rd.lpszName = None rd.lpszAddress = ra rd.ulEIDSize = 0 rd.lpEntryID = None recip = rda # send the message msg

Re: Python To Send Emails Via Outlook Express

2004-12-25 Thread Max M
Steve Holden wrote: Max M wrote: Lenard Lindstrom wrote: So what is this, some kind of competition? If you really though Lenard's quoting was a sin (since I took your remarks to be sardonic), how much more so was your gratuitous repetition thereof? I thought that showing by example might h

Re: How to create an object instance from a string??

2005-03-20 Thread Max M
Tian wrote: How can I create an instance of an object from a string? For example, I have a class Dog: class Dog: def bark(self): print "Arf!!!" def Factory(class_name): classes = { 'Dog':Dog } return classes[class_name] dog = Factory('Dog&

tkinter and textvariable option

2005-03-28 Thread max(01)*
hello everybody. i am a a bit of a newbie in python/tkinter,and i am experimenting a bit with widgets like checkbuttons. in python, you can create a checkbutton instance like this: self.tergicristalli = IntVar() self.b1 = Checkbutton(self.pulsanti_spunta) self.b1.configure( text = "Tergicr

passing keyword args as a parameter

2005-03-29 Thread max(01)*
hi there! this post is somewhat a generalization of one previous question. i was wondering if it is possible to pass an argument list as a parameter to a function. example: def fun_con_pc(pc1 = "Ciao!", pc2 = 42): print pc1 print pc2 fun_con_pc() fun_con_pc(pc1 = "Addio...") fun_con_pc(pc2 = 66

tkinter destroy()

2005-03-29 Thread max(01)*
hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance still exists and has a tkinter name, so testing for None is not feasible: >>> import Tkinter >>> fin

Re: tkinter destroy()

2005-03-29 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 10:37:10 GMT, max(01)* <[EMAIL PROTECTED]> wrote: hi people. when i create a widget, such as a toplevel window, and then i destroy it, how can i test that it has been destroyed? the problem is that even after it has been destroyed, the instance still

Re: passing keyword args as a parameter

2005-03-29 Thread max(01)*
Fredrik Lundh wrote: "max(01)*" <[EMAIL PROTECTED]> wrote: see what i mean? not really, but maybe arg = {"pc2": 666, "pc1": "Addio..."} fun_con_pc(**arg) is what you want? precisely! thanks a lot! macs -- http://mail.python.org/mailman/listinfo/python-list

problem with tkinter

2005-03-29 Thread max(01)*
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar() 7 self.i.set(42) 8 self.s = StringVar() 9 self.s.set("Baobab") 10

problem with tkinter

2005-03-29 Thread max(01)*
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar() 7 self.i.set(42) 8 self.s = StringVar() 9 self.s.set("Baobab") 10

Re: IMAP4.search by message-id ?

2005-03-29 Thread Max M
ror Why do you need the 'HEADER' Wouldn't this be enough? resp, items = server.search(None, 'Message-id', msgID) I am note shure if the msgId should be quoted. I assume not, as it will allways be an integer. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with tkinter

2005-03-30 Thread max(01)*
Pierre Quentel wrote: Instead of indexing self.lab by strings, you can index them by the attributes themselves : self.lab[self.i], and change line 23 into for var in (self.s, self,i) For your example, I wouldn't have used the "text" option in the definition of the labels, then "textvariable

Re: problem with tkinter

2005-03-30 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 22:32:59 +0200, Pierre Quentel <[EMAIL PROTECTED]> wrote: [...] mr brunel, i thank you for prompt reply. i will take my time to read it carefully. meanwhile, i inform you and the ng that someone else gave me a quick and dirty answer to my problem, namely sub

Re: oddness in string.find(sub,somestring)

2005-03-30 Thread Max M
are you going to fix it? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: oddness in string.find(sub,somestring)

2005-03-30 Thread Max M
_string, substring) # note the order searched_string="" print string.find(searched_string, substring) You will not make that error if you use the string method instead. searched_string.find(substring) And you don't have to import anything either.. -- hilsen/regards Max M, Denmar

redundant imports

2005-03-30 Thread max(01)*
hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c, because the latter in turns includes code-3.c. inclusion of modules in c is a purely preproces

Re: problem with tkinter

2005-03-30 Thread max(01)*
Eric Brunel wrote: On Tue, 29 Mar 2005 22:32:59 +0200, Pierre Quentel <[EMAIL PROTECTED]> wrote: Instead of indexing self.lab by strings, you can index them by the attributes themselves : self.lab[self.i], and change line 23 into for var in (self.s, self,i) I really think this is asking fo

Re: How To Do It Faster?!?

2005-03-31 Thread Max Erickson
aining files owned by a specific user, do something like: >>> files=[line.split()[-1] for line in a if owner in line] >>> len(files) 118 This is throwing away directory information, but using os.walk() instead of the /s switch to dir should work, if you need it... max -- http://mail.python.org/mailman/listinfo/python-list

Re: redundant imports

2005-03-31 Thread max(01)*
Tim Jarman wrote: max(01)* wrote: hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c, because the latter in turns includes code-3.c. inclusion of

Re: redundant imports

2005-03-31 Thread max(01)*
Peter Hansen wrote: max(01)* wrote: hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c, because the latter in turns includes code-3.c. inclusion

<    1   2   3   4   5   6   7   8   9   10   >