[Tutor] Beginners question

Alan Gauld alan.gauld at yahoo.co.uk
Mon Apr 6 07:10:09 EDT 2020


On 06/04/2020 10:41, Alan Gauld via Tutor wrote:

>> If you mean the "{first=}" notation, that is very recent. Maybe 3.8?
> 
> No, I meant the ability to provide a __format__() operation in a class.
> 

Ok, I modified Peter's code to work in Python 3.6 with the
format() string method and it worked.
So obviously __format__ capability has been around for a while.
I just missed it...

This is very good news, it means there is no real valid
reason for printing internal attributes of objects in
production code (different for debugging). I like it!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list