"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > One of the nasty bits in a pure-python approach is that there's > no way to write a literal with a fixed length. For example, > instead of writing 0xf7 to get an 8-bit value and 0x12345789 to > get a 32-bit value, you have to instantiate a class like > Word8(0xf7) and Word32(0x12345678). > > That starts to make things pretty hard to read.
This is no worse than having to write decimal(.53489384) or whatever to get a decimal float rather than a binary float, or indeed, than writing cname(init_data) to get an instance of all types/classes. There are many more possible classes than sensible literal formats. A few basic and general types have been blessed with literals that translate into inplicit type constructor calls. Indeed, some literals seem necessary to start the object construction process. However, most types and classes, including your particular special-use classes, do not have corresponding literals and never will in the general release. If PyPy is successful in both being more flexible than CPython and at least about as fast, then you might be able to customize an interpreter with more builtin int classes and more careful parsing of int literals to initialize them.a Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list