[Chimera-users] Do attribute names have to be case sensitive?
olibclarke at gmail.com
Wed Feb 10 11:10:20 PST 2016
OK, that definitely sounds better, thanks Eric. I am familiar with how
variables and attributes work in python, I guess what I was wondering was
if you could use .upper() or .lower() to convert whatever inconsistently
cased string input comes from the user into something that is read
consistently as the same attribute, but having all the attributes lowercase
would be fine - so long as I don't have to remember which letters are upper
case and which are lower case it's all good!
On Wed, Feb 10, 2016 at 2:01 PM, Eric Pettersen <pett at cgl.ucsf.edu> wrote:
> Hi Oliver,
> Attributes in Python are simply case sensitive, so you can have two
> different attributes, one named “stickscale” and the other “stickScale” and
> they are completely different as far as Python is concerned.
> Nonetheless, in ChimeraX the situation will be significantly improved for
> two reasons. One is that all the attributes that ChimeraX cares about will
> be completely lower case (e.g. in ChimeraX “stickScale” is instead
> “stick_scale”), so you would have to somehow inadvertently uppercase a
> letter — which is much harder to do — to run into the same problem you get
> in Chimera 1 by inadvertently lowercasing a letter. The second reason is
> that the setattr command will not by default create new attributes (there
> will be a keyword to allow creation), so accidental typos will be caught in
> most cases.
> Eric Pettersen
> UCSF Computer Graphics Lab
> On Feb 10, 2016, at 7:43 AM, Oliver Clarke <olibclarke at gmail.com> wrote:
> Apologies for spamming the message board... in Chimera at present,
> attribute names (e.g. stickScale) are case sensitive. I understand that
> this is the way it was built and there is probably no changing it in the
> current version of Chimera, but assuming ChimeraX has a similar concept of
> attributes built in, would it be possible to make these case-insensitive? I
> can't imagine there are many situations where case would make a difference
> to the intended attribute (and if there are there probably should not be).
> I have many cases where I type e.g. "setattr m stickscale 2.0", nothing
> happens and there is no error message, and I am confused until I realise I
> should have typed "setattr m stickScale 2.0". Alternatively, raising an
> error message in the status bar when a user attempts to alter a nonexistent
> attribute would also be helpful.
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chimera-users