Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-12 Thread David Hutto
On Sun, Dec 12, 2010 at 2:42 PM, Tim Johnson wrote: > * Steven D'Aprano [101211 17:20]: >> Tim Johnson wrote: >> >>>   I've never had the occasion to use assert() or any other >>>   python - shooting tools, any thoughts on that? >> >> >> Assertions are a great tool, but never ever, under pain of

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-12 Thread Tim Johnson
* Steven D'Aprano [101211 17:20]: > Tim Johnson wrote: > >> I've never had the occasion to use assert() or any other >> python - shooting tools, any thoughts on that? > > > Assertions are a great tool, but never ever, under pain of great pain, > use assert for testing user input or function

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Steven D'Aprano
Tim Johnson wrote: I've never had the occasion to use assert() or any other python - shooting tools, any thoughts on that? Assertions are a great tool, but never ever, under pain of great pain, use assert for testing user input or function arguments. It's tempting to knock up a quick a

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Tim Johnson
* Peter Otten <__pete...@web.de> [101211 03:41]: > (1) the method is spelt __getitem__ (two leading and two trailing > underscores) > > (2) the left side is a python string with legal "%(...)s"-style format > expressions. Given a format string > > s = "%(s.upper())s" > > try to feed it a real

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Peter Otten
Tim Johnson wrote: > This is a resend. I note that the original had an incorrect > `reply-to' ID attached to it. (sorry) > -- > I'm using Python 2.6.5. > The following problem is coming from inside of a complex code base > and involve