By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

Design Q: Changing the indexing of a list

P: n/a
Hello, I was wondering if anyone could suggest a way of doing the
following in Python: I'm writing a class to handle strings of bits,
and I often need to number the bits in different ways, e.g. from the
left starting at zero, or from the right starting at one, and so
forth. I'd quite like to be able to dynamically change how
subscripting works for individual objects, and maybe have that
behaviour transferred to any further objects that that individual
creates (e.g. a new bit string that's the logical negation of the
original). There's actually a couple of other things like that as
well, such as being able to set whether the "+" operation means
concatenation or addition for an object.

This might sound like a horrible thing to want to do, given that it
would then be hard to know what indexing or addition would do in any
given context, but it would be very convenient in the application I'm
looking at. Any suggestions on how I might go about this would be much

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.