Sorry for the confusion  regarding range().

Are there other idioms not in standard python that should be
highlighted?

Thanks!

--Jose

On Sep 16, 11:31 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 16, 2008 at 11:24 AM, Robert Bradshaw
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > On Sep 16, 2008, at 10:42 AM, Jose wrote:
>
> >> All:
>
> >> I'm thinking about putting together another screencast in the same
> >> vein as
>
> >>http://showmedo.com/videos/video?name=2450010&fromSeriesID=245
>
> >> on the special idioms in sage (i.e. the 0..10 = range(10)) and on the
> >> new functions to put GUI components on variables in the notebook
> >> interface.
>
> > I think this is a great idea. Note, however, that range(10) is 1..9
> > as in Python the upper endpoint is not included.
>
> Hey, this is getting confusion, especially since you wrote the code.
>
> (a)    1..9 means nothing -- sage doesn't even have that:
>
> sage: 1..9
> TypeError
>
> (b)    [1..9] does include both endpoints:
>
> sage: [1..9]
> [1, 2, 3, 4, 5, 6, 7, 8, 9]
>
> (c)   [0..9] does not exactly equal range(10) (because of data types),
> but is close:
>
> sage: [0..9]
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
> sage: range(10)
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
> sage: type([0..9] [0])
> <type 'sage.rings.integer.Integer'>
> sage: type(range(10) [0])
> <type 'int'>
> sage: type(srange(10) [0])
> <type 'sage.rings.integer.Integer'>
>
> William
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to sage-edu@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to