On 16Jan2016 18:43, boB Stepp <robertvst...@gmail.com> 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 <c...@zip.com.au>

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 <rj...@hermes.cam.ac.uk>

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to