Hello All, Since this is my first commit, I just want to make sure that I have done these things in the appropriate way. Here's what I did: 1. Added a wiki page: https://sourceforge.net/p/cctbx/wiki/Subversion%20set%20up/ 2. Added the method as_miller_arrays_map() to iotbx_mtz_ext.object, which is declared in iotbx/mtz/__init__.py. 3. Added a test for this functionality in the file iotbx/mtz/tst_miller_map.py Please let me know if the manner in which I did anything could use improvement. James
Hi James,
Congratulations on your first commit! Without wanting to nitpick too much
there were a couple of things that I would like to comment on:
Personally I would have preferred the function name
as_miller_arrays_dict(), as this would make it a lot clearer (at least to
me) what to expect from the function before looking at the documentation.
At first I was confused because the 'map' part of the name made me think
that it was doing something to do with electron density maps (especially
given the context of miller arrays). Replacing 'map' with 'dict' in the
name would avoid any potential for confusion.
Also, I would prefer the function arguments to be spelled out explicitly
without using *args and **kwds, so that I can figure out what arguments it
takes without having to read through the function source code to figure out
that internally you are calling self.as_miller_arrays(), and then have to
go and look up the function arguments for that. My IDE (WingIDE) shows me
the function signature in its source assistant and also provides code
completion for function arguments and keywords. However these won't be of
much use when functions only list *args and **kwds.
Cheers,
Richard
On 17 April 2013 21:57, James Stroud
Hello All,
Since this is my first commit, I just want to make sure that I have done these things in the appropriate way.
Here's what I did:
1. Added a wiki page: https://sourceforge.net/p/cctbx/wiki/Subversion%20set%20up/ 2. Added the method as_miller_arrays_map() to iotbx_mtz_ext.object, which is declared in iotbx/mtz/__init__.py. 3. Added a test for this functionality in the file iotbx/mtz/tst_miller_map.py
Please let me know if the manner in which I did anything could use improvement.
James
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
On Wed, Apr 17, 2013 at 10:19 PM, Richard Gildea
Also, I would prefer the function arguments to be spelled out explicitly without using *args and **kwds, so that I can figure out what arguments it takes without having to read through the function source code to figure out that internally you are calling self.as_miller_arrays(), and then have to go and look up the function arguments for that.
My preference is actually the opposite (I do the same thing quite a bit in my code), because otherwise there is no guarantee that keyword arguments added to add_miller_arrays will also be usable with add_miller_arrays_map. Using *args, **kwds makes the APIs explicitly the same. (That said, I'm increasing favoring using **kwds alone in these circumstances.)
My IDE (WingIDE) shows me the function signature in its source assistant and also provides code completion for function arguments and keywords. However these won't be of much use when functions only list *args and **kwds.
<insert generic snarky vi advocacy here> -Nat
When I look at a function and do not understand what it does given it's name and list of arguments I look no more and write my own. Always. This is because my believe that if the author of that function did not bother to make the interface clear it says something about quality of the job as a whole (to me at least), and I don't have time to take chances or waste it reading more. Pavel On 4/17/13 11:02 PM, Nathaniel Echols wrote:
Also, I would prefer the function arguments to be spelled out explicitly without using *args and **kwds, so that I can figure out what arguments it takes without having to read through the function source code to figure out that internally you are calling self.as_miller_arrays(), and then have to go and look up the function arguments for that. My preference is actually the opposite (I do the same thing quite a bit in my code), because otherwise there is no guarantee that keyword arguments added to add_miller_arrays will also be usable with add_miller_arrays_map. Using *args, **kwds makes the APIs explicitly
On Wed, Apr 17, 2013 at 10:19 PM, Richard Gildea
wrote: the same. (That said, I'm increasing favoring using **kwds alone in these circumstances.) My IDE (WingIDE) shows me the function signature in its source assistant and also provides code completion for function arguments and keywords. However these won't be of much use when functions only list *args and **kwds. <insert generic snarky vi advocacy here>
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
+1 If I want to make sense of a function the first thing I do is look at the keyword arguments: if I see "not telling" it does not make the code more usable to me. Of course if the doc strings define exactly what keywords to pass in and what they should do then fair enough: I have not looked closely enough at these examples to comment on the details. Unlijke Pavel I would not necessarily write my own though :o) Best wishes, Graeme On 18 Apr 2013, at 07:10, Pavel Afonine wrote:
When I look at a function and do not understand what it does given it's name and list of arguments I look no more and write my own. Always. This is because my believe that if the author of that function did not bother to make the interface clear it says something about quality of the job as a whole (to me at least), and I don't have time to take chances or waste it reading more.
Pavel
On 4/17/13 11:02 PM, Nathaniel Echols wrote:
Also, I would prefer the function arguments to be spelled out explicitly without using *args and **kwds, so that I can figure out what arguments it takes without having to read through the function source code to figure out that internally you are calling self.as_miller_arrays(), and then have to go and look up the function arguments for that. My preference is actually the opposite (I do the same thing quite a bit in my code), because otherwise there is no guarantee that keyword arguments added to add_miller_arrays will also be usable with add_miller_arrays_map. Using *args, **kwds makes the APIs explicitly
On Wed, Apr 17, 2013 at 10:19 PM, Richard Gildea
wrote: the same. (That said, I'm increasing favoring using **kwds alone in these circumstances.) My IDE (WingIDE) shows me the function signature in its source assistant and also provides code completion for function arguments and keywords. However these won't be of much use when functions only list *args and **kwds. <insert generic snarky vi advocacy here>
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- 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
Thanks everyone for the feedback. I have never really collaborated on code, so I am in definite need of community opinion on matters of style.
I have changed the method to reflect the present vote of 3:1 for explicit argument lists, and will keep the sentiment in mind in the future. I have also renamed the method as_miller_arrays_dict. I figure the rename is safe because it has only been a couple of hours since I pushed the original code.
James
On Apr 18, 2013, at 1:10 AM,
+1
If I want to make sense of a function the first thing I do is look at the keyword arguments: if I see "not telling" it does not make the code more usable to me. Of course if the doc strings define exactly what keywords to pass in and what they should do then fair enough: I have not looked closely enough at these examples to comment on the details.
Unlijke Pavel I would not necessarily write my own though :o)
Best wishes,
Graeme
On 18 Apr 2013, at 07:10, Pavel Afonine wrote:
When I look at a function and do not understand what it does given it's name and list of arguments I look no more and write my own. Always. This is because my believe that if the author of that function did not bother to make the interface clear it says something about quality of the job as a whole (to me at least), and I don't have time to take chances or waste it reading more.
Pavel
On 4/17/13 11:02 PM, Nathaniel Echols wrote:
Also, I would prefer the function arguments to be spelled out explicitly without using *args and **kwds, so that I can figure out what arguments it takes without having to read through the function source code to figure out that internally you are calling self.as_miller_arrays(), and then have to go and look up the function arguments for that. My preference is actually the opposite (I do the same thing quite a bit in my code), because otherwise there is no guarantee that keyword arguments added to add_miller_arrays will also be usable with add_miller_arrays_map. Using *args, **kwds makes the APIs explicitly
On Wed, Apr 17, 2013 at 10:19 PM, Richard Gildea
wrote: the same. (That said, I'm increasing favoring using **kwds alone in these circumstances.) My IDE (WingIDE) shows me the function signature in its source assistant and also provides code completion for function arguments and keywords. However these won't be of much use when functions only list *args and **kwds. <insert generic snarky vi advocacy here>
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- 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
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Am Donnerstag 18 April 2013 09:40:27 schrieb James Stroud:
Thanks everyone for the feedback. I have never really collaborated on code, so I am in definite need of community opinion on matters of style.
I have changed the method to reflect the present vote of 3:1 for explicit argument lists, and will keep the sentiment in mind in the future. I have also renamed the method as_miller_arrays_dict. I figure the rename is safe because it has only been a couple of hours since I pushed the original code.
If you've got some additional time it would be great, if you could also document the arguments and the return value(s) of the function in sphinx style (= :param...: / see xray/structure.py) for quite a few examples. Cheers, Jan
participants (6)
-
Graeme.Winter@diamond.ac.uk
-
James Stroud
-
Jan Marten Simons
-
Nathaniel Echols
-
Pavel Afonine
-
Richard Gildea