Re: Making string-formatting smarter by handling generators?

2008-02-27 Thread grflanagan
On Feb 27, 5:23 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > Is there an easy way to make string-formatting smart enough to > gracefully handle iterators/generators? E.g. > >transform = lambda s: s.upper() >pair = ('hello', 'world') >print "%s, %s" % pair # works >print "%s, %s" % ma

Re: Getting python docstings

2008-02-27 Thread grflanagan
On Feb 27, 3:42 pm, Rufman <[EMAIL PROTECTED]> wrote: > ok...i took a look at epydoc. I can produce html documentation, but > when i try to generate a pdf, I get this error: > > Error: latex failed: File `fancyhdr.sty' not found.latex: Error >response from server: 404 > > my system: > - Mi

Re: Documentation - which format

2008-02-27 Thread grflanagan
On Feb 26, 11:47 pm, Jumping Arne <[EMAIL PROTECTED]> wrote: > I'm considering using plain text file for documenting certain things (nothing > to do with Python) and I'm looking at different "formatting systems" ... > preferable with a python implementation to render the text at least as HTML - > p

Re: __getattribute__ meta class?

2008-02-26 Thread grflanagan
On Feb 26, 3:43 am, "bambam" <[EMAIL PROTECTED]> wrote: > I have a class containing a series of classes like this: > > class Th(Externaldevice): > class _Communicate(commandset2.CommandSet_Communicate): > def __getattribute__(self,attrname): > attr = > commandset2.CommandSet_Communicate

Replacing 'if __name__ == __main__' with decorator (was: Double underscores -- ugly?)

2008-02-21 Thread grflanagan
On Feb 19, 10:01 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Berwyn <[EMAIL PROTECTED]> wrote: > >> Is it just me that thinks "__init__" is rather ugly? Not to mention > >> "if __name__ == '__main__': ..."? > > > That ugliness has long been my biggest bugbear with python, too. The > > __name__ =

Re: different instances with different data descriptors with the same name

2008-02-18 Thread grflanagan
On Feb 18, 11:21 am, Fabrizio Pollastri <[EMAIL PROTECTED]> wrote: > Data descriptors are set as attributes of object types. So if one has many > instances of the same class and wants each instance to have a different > property > (data descriptor) that can be accessed with a unique attribute name

Re: regex question

2008-02-13 Thread grflanagan
On Feb 13, 1:53 pm, mathieu <[EMAIL PROTECTED]> wrote: > I do not understand what is wrong with the following regex expression. > I clearly mark that the separator in between group 3 and group 4 > should contain at least 2 white space, but group 3 is actually reading > 3 +4 > > Thanks > -Mathieu >

Re: Why does list have no 'get' method?

2008-02-11 Thread grflanagan
On Feb 8, 4:24 pm, [EMAIL PROTECTED] wrote: > > > val = BETTER foo THAN bar > > > > ;-) > > > > Cobol-strikes-back-ly yours, > > > > George > > > I use a ETL language/tool that actually has a function for this kind > > of thing: > > > NulltoValue(value,defaultValue) > > > it returns defaultValue if

Re: getting all user defined attributes of a class

2008-02-07 Thread grflanagan
On Feb 6, 11:07 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > Hi > > How do I get user defined attributes of a class? e.g > > Class A(object) : > self.x = 1 > -- > > I want something like: > for userattrib in A.getAllUserAttribute() : > print userattrib > class Meta(type):

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-31 Thread grflanagan
On Jan 31, 2:56 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-01-30, grflanagan <[EMAIL PROTECTED]> wrote: > > > > > On Jan 29, 5:39 pm, kj <[EMAIL PROTECTED]> wrote: > > For command line options I get a long way with this: >

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-30 Thread grflanagan
On Jan 29, 5:39 pm, kj <[EMAIL PROTECTED]> wrote: [...] > It's not the Python syntax that I'm having problems with, but rather > with larger scale issues such as the structuring of packages, > techniques for code reuse, test suites, the structure of > distributions,... Python and Perl seem to come

Re: How to detect a remote webpage is accessible? (in HTTP)

2008-01-18 Thread grflanagan
On Jan 18, 6:22 am, "甜瓜" <[EMAIL PROTECTED]> wrote: > Howdy, all, > I want to use python to detect the accessibility of website. > Currently, I use urllib > to obtain the remote webpage, and see whether it fails. But the problem is > that > the webpage may be very large; it takes too long tim

Re: searching an XML doc

2008-01-16 Thread grflanagan
On Jan 15, 9:33 pm, Gowri <[EMAIL PROTECTED]> wrote: > Hello, > > I've been reading about ElementTreee and ElementPath so I could use > them to find the right elements in the DOM. Unfortunately neither of > these seem to offer XPath like capabilities where I can find elements > based on tag, attrib

Re: Embedding python code into text document question.

2008-01-10 Thread grflanagan
On Jan 10, 2:10 pm, Thomas Troeger <[EMAIL PROTECTED]> wrote: > Dear all, > > I've written a program that parses a string or file for embedded python > commands, executes them and fills in the returned value. The input might > look like this: > > process id: $$return os.getpid()$$ > current date: $

Re: I'm searching for Python style guidelines

2008-01-08 Thread grflanagan
On Jan 8, 3:08 am, ajaksu <[EMAIL PROTECTED]> wrote: > On Jan 7, 11:25 am, [EMAIL PROTECTED] wrote: > > > Anything written somewhere that's thorough? Any code body that should > > serve as a reference? > > I've done this search before and it was very interesting, doing it > again gave me new result

Re: checking a string against multiple patterns

2007-12-18 Thread grflanagan
On Dec 18, 1:41 pm, tomasz <[EMAIL PROTECTED]> wrote: > Hi, > > here is a piece of pseudo-code (taken from Ruby) that illustrates the > problem I'd like to solve in Python: > > str = 'abc' > if str =~ /(b)/ # Check if str matches a pattern > str = $` + $1# Perform some action > elsif str

Re: listdir() with mask

2007-12-14 Thread grflanagan
On Dec 14, 2:00 pm, "Vladimir Rusinov" <[EMAIL PROTECTED]> wrote: >Is there any easy way to list files using bash-like patterns? Something like >listfiles("/var/log/*.log"), listfiles("/var/{cache,run}/*"). > On 12/14/07, Jeff McNeil <[EMAIL PROTECTED]> wrote: > > > > > Sure is.. check out the glob

Re: "Python" is not a good name, should rename to "Athon"

2007-12-04 Thread grflanagan
On Dec 4, 11:53 am, [EMAIL PROTECTED] wrote: > On Dec 4, 11:36 am, MarkE <[EMAIL PROTECTED]> wrote: > > > Ithon > > Pie - Fun Pie-a-thon? http://montypython.tribe.net/thread/fd519910-25e3-4102-b898-8815d6ece32a http://www.flickr.com/photos/kirstywombat/1862165664/ -- http://mail.python.org/mail