On 31 Aug 2005 07:13:26 -0700, "Kay Schluehr" <[EMAIL PROTECTED]> wrote:

>Bengt Richter wrote:
>
>> How about interpreting seq[i] as an abbreviation of seq[i%len(seq)] ?
>> That would give a consitent interpretation of seq[-1] and no errors
>> for any value ;-)
>
>Cool, indexing becomes cyclic by default ;)
>
>But maybe it's better to define it explicitely:
>
>    seq[!i] = seq[i%len(seq)]
>
>Well, I don't like the latter definition very much because it
>introduces special syntax for __getitem__. A better solution may be the
>introduction of new syntax and arithmetics for positive and negative
>infinite values. Sequencing has to be adapted to handle them.
>
>The semantics follows that creating of limits of divergent sequences:
>
>    !0 =  lim n
>          n->infinity
>
>That enables consistent arithmetics:
>
>    !0+k = lim n+k         -> !0
>            n->infinity
>
>    !0/k = lim n/k         ->  !0 for k>0,
>            n->infinity        -!0 for k<0
>                               ZeroDevisionError for k==0
>
>
>etc.
>
>In Python notation:
>
>>>> !0
>!0
>>>> !0+1
>!0
>>>> !0>n    # if n is int
>True
>>>> !0/!0
>Traceback (...)
>...
>UndefinedValue
>>>> !0 - !0
>Traceback (...)
>...
>UndefinedValue
>>>> -!0
>-!0
>>>> range(9)[4:!0] == range(9)[4:]
>True
>>>> range(9)[4:-!0:-1] == range(5)
>True
Interesting, but wouldn't that last line be
 >>> range(9)[4:-!0:-1] == range(5)[::-1]

>Life can be simpler with unbound limits.
Hm, is "!0" a di-graph symbol for infinity?
What if we get full unicode on our screens? Should
it be rendered with unichr(0x221e) ? And how should
symbols be keyed in? Is there a standard mnemonic
way of using an ascii keyboard, something like typing
Japanese hiragana in some word processing programs?

I'm not sure about '!' since it already has some semantic
ties to negation and factorial and execution (not to mention
exclamation ;-)  If !0 means infinity, what does !2 mean?

Just rambling ... ;-)

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to