Authentication

2006-07-18 Thread bigodines
Hello guys, I'm trying to learn python by making some small programs that could be useful for some bigger propouses. In fact, i've made a small "check latest-modified" for webpages and it's working great. The next step I would like to do is to check if I have new e-mails (I don't wanna read it fr

Re: Recursive function returning a list

2006-07-18 Thread Bruno Desthuilliers
Boris Borcic a écrit : > Hello Bruno, > > Bruno Desthuilliers wrote: > >> Boris Borcic wrote: >> Do you have any ideas? >>> >>> >>> you could use a recursive generator, like >>> >>> def genAllChildren(self) : >>> for child in self.children : >>> yield child >>> for childc

Re: Object Persistence Using a File System

2006-07-18 Thread Bruno Desthuilliers
Nick Vatamaniuc a écrit : (please don't top-post - corrected) > > Bruno Desthuilliers wrote: > (snip) >>A few observations and questions : >>- you should avoid tests on concrete types as much as possible - at >>least use isinstance > > Good point about isinstance. Here is a good explanation w

Re: Coding style

2006-07-18 Thread Carl Banks
Bruno Desthuilliers wrote: > "Irrelevant" may not be the best expression of my thought here - it's > just that Carl's assertion is kind of a tautology and doesn't add > anything to the discussion. If Python had been designed as statically > typed (with declarative typing), the rules would be differ

Re: Coding style

2006-07-18 Thread Carl Banks
Bruno Desthuilliers wrote: > There are less risk of a typo with "if a:" than with "if len(a) > 0". So, it's more important to protect against typos than subtle bugs? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Track keyboard and mouse usage

2006-07-18 Thread Lars
Diez B. Roggisch wrote: > will make the devices world readable. While I haven't thought about any > security implications that might have (and am not especially > knowledgeable in such things to be honest), I'm convinced it is way less > likely to introduce any exploitable holes than suid root w

Re: how to know if socket is still connected

2006-07-18 Thread John J. Lee
Grant Edwards <[EMAIL PROTECTED]> writes: [...] > > Often normal send() and recv() semantics have been mistaught. > > An alert alien, looking at other common APIs in isolation, > > might reasonably wonder whether there is some sort of > > still_ok_to_use() sort of check as part of TCP. As it hap

Re: Coding style

2006-07-18 Thread Bruno Desthuilliers
Carl Banks a écrit : > Bruno Desthuilliers wrote: > >>There are less risk of a typo with "if a:" than with "if len(a) > 0". > > > So, it's more important to protect against typos than subtle bugs? > People making smart points are really annoying... !-) wrt/ to the "subtle bug" point, MHO is t

Re: XMLRPC Solution Code

2006-07-18 Thread dylpkls91
Frank Millman wrote: > I use something called 'srvany' - >http://support.microsoft.com/kb/q137890/ I am familiar with srvany. Seems like it is a whole bunch easier than the PyWin32 stuff. I'll write a wrapper script that can be used like this: createservice.py -myservicename -myservicepath or

Re: Coding style

2006-07-18 Thread Carl Banks
Bruno Desthuilliers wrote: > Carl Banks a écrit : > > Bruno Desthuilliers wrote: > > > >>There are less risk of a typo with "if a:" than with "if len(a) > 0". > > > > > > So, it's more important to protect against typos than subtle bugs? > > > > People making smart points are really annoying... !-

Re: No need to close file?

2006-07-18 Thread Kevin Watters
There's always the new 'with' statement in Python 2.5. So instead of > f = open('foo', 'r') > try: >for line in f: > print line > finally: >f.close() > ...you do: with open('foo','r') as f: for line in f: print line It's at least a little bit cleaner, and it will clos

Re: Coding style

2006-07-18 Thread Jorge Godoy
"Carl Banks" <[EMAIL PROTECTED]> writes: > Well, I certainly can agree with that, except for the last point. :) I > certainly wouldn't want to keep that unfortunate behavior around just I > have something to use as an argument using len to test emptiness. On the other hand, having this behavior

Re: New SourceForge project: Diet Python!!!

2006-07-18 Thread skip
>> Hm didn't I leave ctypes in there? I added calldll because it >> had a really nice can opener. Oh, I have no idea (didn't download). I just sort of assumed if you had included calldll you probably hadn't included ctypes. Skip -- http://mail.python.org/mailman/listinfo/python-li

Re: CSV with comments

2006-07-18 Thread skip
John> This is recursive. Unlikely of course, but if the file contained a John> large number of empty lines, might this not cause the recursion John> limit to be exceeded? Sure, but I was lazy. ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: CSV with comments

2006-07-18 Thread skip
Whoops, missed the second part. John> Is there any reason to prefer this approach to Daniel's, apart John> from being stuck with an older (pre-yield) version of Python? No, it's just what I came up with off the top of my head. John> A file given to csv.reader is supposed to be opened

Re: Coding style

2006-07-18 Thread Terry Reedy
"Patrick Maupin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Carl Banks wrote: >> def process_values(lst): >> if not lst: >> return >> do_expensive_initialization_step() >> for item in lst: >> do_something_with(item) >>

Re: Coding style

2006-07-18 Thread Carl Banks
Jorge Godoy wrote: > "Carl Banks" <[EMAIL PROTECTED]> writes: > > > Well, I certainly can agree with that, except for the last point. :) I > > certainly wouldn't want to keep that unfortunate behavior around just I > > have something to use as an argument using len to test emptiness. > > On the o

vmware/python web dev

2006-07-18 Thread [EMAIL PROTECTED]
someone has made a "virtual appliance" specialized for python web development. it has a huge list of included software. if you're interested, see: http://www.vmware.com/vmtn/appliances/directory/289 -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive function returning a list

2006-07-18 Thread malkarouri
Bruno Desthuilliers wrote: > Boris Borcic a écrit : > > Hello Bruno, > > > > Bruno Desthuilliers wrote: > > > >> Boris Borcic wrote: > >> > Do you have any ideas? > >>> > >>> > >>> you could use a recursive generator, like > >>> > >>> def genAllChildren(self) : > >>> for child in self.chil

Re: win32com.client.Dispatch - understanding error messages

2006-07-18 Thread mirandacascade
Duncan Booth wrote: > Are you really sure that the browser isn't making guesses about what you > meant and correcting the error for you? Does what remains in the address > bar when the page is retrieved really match *exactly* what you copied and > pasted? Thank you for that pointer. The answer i

Re: range() is not the best way to check range?

2006-07-18 Thread Simon Forman
tac-tics wrote: > Simon Forman wrote: > > To me, and perhaps others, "T = > > set(xrange(0, 1, 23))" and "n in T" are somewhat easier to read > > and write than "not n % 23 and 0 <= n < 1", YMMV. > > Eh? How is the first easier to read than the second?? You have a nested > function call in

Re: Dispatch with multiple inheritance

2006-07-18 Thread Michele Simionato
Michael J. Fromberger ha scritto: > Consider the following class hierarchy in Python: > > Is there a better (i.e., more elegant) way to handle the case marked > (**) above? > > Curious, > -M > > -- > Michael J. Fromberger | Lecturer, Dept. of Computer Science > http://www.dartmouth.e

Re: Authentication

2006-07-18 Thread Nick Vatamaniuc
Matheus, There is libgmail @ http://libgmail.sourceforge.net/ Here is the excerpt from their page. """ The following code logs into an account, retrieves a list of threads, displays information about them and displays the source of the individual messages. """ import libgmail ga = libgmail.GmailAcc

Re: Object Persistence Using a File System

2006-07-18 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Chris Spencer wrote: > I've been looking for a method of transparent, scalable, and > human-readable object persistence... Don't do object persistence. What is an object? It's a combination of code and data. Code structure is internal to your program--it has no bus

Partial classes

2006-07-18 Thread Sanjay
Hi All, Not being able to figure out how are partial classes coded in Python. Example: Suppose I have a code generator which generates part of a business class, where as the custome part is to be written by me. In ruby (or C#), I divide the code into two source files. Like this: GeneratedPerson.

Re: What is a type error?

2006-07-18 Thread Marshall
Joachim Durchholz wrote: > Marshall schrieb: > > Chris Smith wrote: > >> Joachim Durchholz <[EMAIL PROTECTED]> wrote: > >> I *think* I understand Marshall here. When you are saying "assignment", > >> you mean assignment to values of attributes within tuples of the cell. > >> When Marshall is sayin

Re: Dispatch with multiple inheritance

2006-07-18 Thread looping
Michael J. Fromberger wrote: > > Is there a better (i.e., more elegant) way to handle the case marked > (**) above? > You have to call super in each method __init__, if you don't, the call chain break before the end: class A (object): def __init__(self): super(A, self).__init__()

Re: Partial classes

2006-07-18 Thread alex23
Sanjay wrote: > Not being able to figure out how are partial classes coded in Python. Hi Sanjay, To the best of my knowledge, Python currently has no support for partial classes. However, BOO (http://boo.codehaus.org/) - which is a Python-like language for the .NET CLI)- _does_ support partial c

Re: Python : Event-Driven Paradigm

2006-07-18 Thread Kusanagi
Were you looking for more specific features?   Parallel Processing.   Grant,             It looks like I have a lot more studying to do, all of the information that I have seems to be screwed up. I will look at event loops in Python to see if that answers my question. I was just looking a

Re: Partial classes

2006-07-18 Thread Kay Schluehr
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files. L

<    1   2   3