Jan-05-2020, 08:32 AM
(This post was last modified: Jan-05-2020, 08:32 AM by Gribouillis.)
I like the idea, but wouldn't it be a little lighter if instead of a
Text
class, you defined a special type of formatting strings, say fmtstr
, so that you could writes = fmtstr('{} had {:w}. The {:o} knight to enter the castle had {:w}').format( ['Arthur', 'Lancelot', 'Robin'], (2, 'monkey'), 1, (3, 'dog'))The
fmstr.format()
method would select its behavior depending the types of its arguments: list, tuples, numbers etc.