By the way, leo-5.9 could not save py nodes where f-str syntax was used. Does it work on 6.x?
2019-09-04 17:54 GMT+03:00, rengel <[email protected]>: > Why not go for f-strings (Python 3.6+). See for instance: > > http://zetcode.com/python/fstring/ > > The code: > > def __repr__(self): > # Better for g.printObj. > val = str(self.val).replace('\n', ' ') > return 'GS: %20s %7s = %s' % ( > g.shortFileName(self.path), self.kind, g.truncate(val, 50)) > > would look as follows: > > def __repr__(self): > # Better for g.printObj. > val = (str(self.val).replace('\n', ' '))[0:50] # Save call to > g.truncate > return f'GS: {g.shortFileName(self.path):20} {self.kind:7} = {val}' > > Less typing, Smaller, faster, cleaner. > > -- > You received this message because you are subscribed to the Google Groups > "leo-editor" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/leo-editor/75137e8f-3f5d-4dab-a2b6-e03862d68047%40googlegroups.com. > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAC%2B8SVxm7AzwKu8VrjCAvGQ%2BQGYDjWQ4CPaAJPWgy7hN5CNSLQ%40mail.gmail.com.
