[cctbxbb] show() not __str__ - why?

Graeme.Winter@Diamond.ac.uk Graeme.Winter at diamond.ac.uk
Fri Jun 1 01:21:07 PDT 2018


Came up in conversation - how come the motif for printing / providing object info is to call show() and pass a file handle rather than the more pythonic __str__?

See e.g.


I know in dials we could do it differently however we inherited the motif from cctbx & I am not sure why things work that way - figured there must be a reason...

This is also under discussion under https://github.com/dials/dials/pull/567 but I thought it was worth making sure we knew the reasons why cctbx uses it's own way of doing something...

(also it's quite annoying that printing things will give you say space_group object i.e. much like printing type(object), when you want to see it's contents - like printing j and being told it is an int!)

Thanks Graeme

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

More information about the cctbxbb mailing list