[Python-ideas] PEP pre-draft: Support for indexing with keyword arguments
Stefano Borini
stefano.borini at ferrara.linux.it
Wed Jul 2 12:08:25 CEST 2014
On Wed, Jul 02, 2014 at 03:36:23AM +0100, Rob Cliffe wrote:
> 1) Ahem, doesn't a[3] (usually) return the *fourth* element of a ?
Yes. I changed the indexes many times for consistency and that slipped
through. It used to be a[2]
>
> low_accuracy_energy = computeEnergy(molecule, BasisSet[Z=3]) """
>
> is about, and whether it is really (conceptually) related to indexing,
> or just a slick hack. I guess it could be anything, depending on the
> implementation of __getitem__.
The reason behind an indexing is that the BasisSet object could be internally
represented as a numeric table, where rows are associated to individual elements
(e.g. row 0:5 to element 1, row 5:8 to element 2) and each column is associated
to a given degree of accuracy (e.g. first column is low accuracy, second column
is medium accuracy etc). You could say that users are not concerned with the
internal representation, but if they are eventually allowed to create these
basis sets in this tabular form, it makes a nice conceptual model to keep the
association column <-> accuracy and keep it explicit in the interface.
More information about the Python-ideas
mailing list