Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Give me one example where you would ever want a copy of a tuple rather than another reference to it.


That wasn't my point. My point was that [:] conserves the type of sequence.

Also [:] returns a reference to the existing tuple instead of a copy:

    >>> a = (1, 2, 3)

    >>> id(a)
    3081276268L

    >>> id(a[:])
    3081276268L




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: