Talin wrote:
> A new version is up, incorporating material from the various discussions 
> on this list:
> 
>       http://www.python.org/dev/peps/pep-3101/

I have a number of parts of this implemented.  I'm refactoring the 
original PEP 3101 sandbox code to get it working.  Mostly it involves 
un-optimizing string handling in the original work :(

These tests all pass:

self.assertEquals('{0[{1}]}'.format('abcdefg', 4), 'e')
self.assertEquals('{foo[{bar}]}'.format(foo='abcdefg', bar=4), 'e')
self.assertEqual("My name is {0}".format('Fred'), "My name is Fred")
self.assertEqual("My name is {0[name]}".format(dict(name='Fred')),
                  "My name is Fred")
self.assertEqual("My name is {0} :-{{}}".format('Fred'),
                  "My name is Fred :-{}")

I have not added the !r syntax yet.

I've only spent 5 minutes looking at this so far, but I can't figure out 
where to add a __format__ to object.  If someone could point me to the 
right place, that would be helpful.

Thanks.
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to