On 16Jan2016 18:43, boB Stepp <[email protected]> wrote:
This led me to try:
mylist[:None]
[100, 200, 300, 400, 500]
So, in effect, None is acting as a place holder for that final
position in slices. Also, I would never have thought to be able to
use a logical "or" inside an index in Peter's "[:-i or None]".
Yah, like the default value for many missing parameters. When you don't need an
expression after the ":" you can of course write:
mylist[:]
much like writing a function "def f(x, y=None)"; None is a sentinel value -
specially recognised as nor in the normal domain for that value.
Cheers,
Cameron Simpson <[email protected]>
Q: How does a hacker fix a function which doesn't work for all of the elements
in its domain?
A: He changes the domain.
- Rich Wareham <[email protected]>
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor