> On Mon, 14 Jan 2002, Skip Montanaro wrote: > > $'BDFL = $sys.copyright.split()[4].upper()' > > ---> ('BDFL = ' + str(sys.copyright.split()[4].upper())) > > > > How to you know when to stop gobbling after seeing a dollar sign in the > > string? > > Parse using the "NAME trailer*" production in Grammar/Grammar. Except that whitespace is significant, at least in the sample implementation: >>> i = Itpl.itpl >>> x=4 >>> y=3 >>> i("This is x: $x. This is y: $y.") # doesn't grab (x.This) 'This is x: 4. This is y: 3.' >>> i("This is x: $x.This is y: $y.") # does grab (x.This) AttributeError: 'int' object has no attribute 'This' This doesn't seem to be mentioned in the PEP. ## Jason Orendorff http://www.jorendorff.com/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4