On Sat, Oct 23, 2010 at 8:07 PM, Jason Grout
<[email protected]> wrote:
> A correction to my corrections inline below!
>
> On 10/23/10 9:56 PM, Jason Grout wrote:
>>
>> A few little corrections or explanations inline below...
>>
>> On 10/23/10 8:34 AM, Francois Maltey wrote:
>>>
>>> Rolandb wrote :
>>>>
>>>> test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if
>>>> gcd(k1,k2)==1)
>>>> print [t for t in test]
>>>> print [t for t in test]
>>>> [(1, 2), (1, 3), (2, 3)]
>>>> []
>>>>
>>> I begun to confuse lists L with [...] we can free change :
>>> one change one term by L[1]=123, and change the length by
>>> L[3:4]=[7,6,8], or del, or L.pop(), ...
>>> And tuple with (...) as T=(12,13,14,15) it's impossible to change.
>>>
>>> A void tuple or a void list are [] and ()
>>
>> Actually, the empty tuple is (,)---you mention why in this next sentence:
>>
>
> You were right and I was wrong!
>
> sage: type(())
> <type 'tuple'>
> sage: (,)
> ------------------------------------------------------------
>   File "<ipython console>", line 1
>     (,)
>      ^
> SyntaxError: invalid syntax

In most cases, it's really the comma (not the parentheses) that
creates the tuple.

sage: a = 123,
sage: a
(123,)

The parentheses are often needed for grouping purposes though.

- Robert

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to