Re: parsing of structured text

2010-10-28 Thread Robert Fendt
On 28 Okt., 05:59, Kushal Kumaran wrote: > Using code someone else has already written would qualify as pythonic, IMO. > > http://pypi.python.org/pypi/vobject That seems to do what I need, thank you. I seem to have been a bit blind when I looked for existing packages. Of course, using vobject "o

parsing of structured text

2010-10-27 Thread Robert Fendt
Hi all, I have to parse a file containing (slightly erroneous) vCal data. The format of vCal/iCal is that of a structured ASCII file, not unlike XML in a way. A vCal block contains information on a line-by-line basis, with the possibility of sub-blocks (for events). BEGIN:VCALENDAR VERSION:1.0 BE

Re: "Usability, the Soul of Python"

2010-03-30 Thread Robert Fendt
And thus spake "Alf P. Steinbach" Tue, 30 Mar 2010 13:40:22 +0200: > > From a usability standpoint, the braces go with the lines to print out the > stanza rather than the for statement or the code after, so the following is > best: > > for(i = 99; i > 0; ++i) > { > printf("%d slabs

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Robert Fendt
And thus spake MRAB Tue, 30 Mar 2010 22:43:04 +0100: > I think you mean that it's very _un-Pythonic_ (perhaps because it's very > very Pythonesque)! :-) Yes. Of course. What was I thinking. ;-) Regards, Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Robert Fendt
And thus spake John Bokma Tue, 30 Mar 2010 13:19:19 -0600: > And > > a == b and 'Yes' or 'No' > > isn't a Perl-ism? I never said that this would be better. I don't even get the point of what the advantage is supposed to be of inverting the order of the return statement and the conditional ch

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Robert Fendt
And thus spake Steve Holden Tue, 30 Mar 2010 13:56:04 -0400: > >> Yes, Python has ternary operator-like syntax: > >> return ('Yes' if a==b else 'No') > >> > >> Note that this requires a recent version of Python. > > > > Who let the dogs in? That's awful syntax. > > Yes, that's deliberately