Re: Restricting the alphabet of a string
- From: John Machin <sjmachin@xxxxxxxxxxx>
- Date: 30 Apr 2007 11:14:10 -0700
On Apr 30, 9:53 pm, "Nathan Harmston" <ratchetg...@xxxxxxxxxxxxxx>
wrote:
Hi,
I ve being thinking about playing around with bit strings but use in
some encoding problems I m considering and was trying to decide how to
implement a bit string class. Is there a library out there for doing
basic things with bit strings already is my first question?
I know that I can extend string to bit string, but is there anyway I
can force the alphabet to be restricted to 1's and 0's (or even 1, 0
and -1, as an extension to from trinary strings).
class Binary_String(String):
pass
See if you can pick which line below is impractically different to the
others:
binary: 0, 1
"trinary": -1, 0, 1
octal: 0, 1, 2, 3, 4, 5, 6, 7
decimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
HTH,
John
.
- References:
- Restricting the alphabet of a string
- From: Nathan Harmston
- Restricting the alphabet of a string
- Prev by Date: Is it possible to merge xrange and slice?
- Next by Date: Re: How to pass in argument to timeit.Timer
- Previous by thread: Re: Restricting the alphabet of a string
- Next by thread: [ANN] Update to Python Quick Reference Card (for Python 2.4) (v0.67)
- Index(es):
Relevant Pages
|