reset password
Author Message
rabbott
Posts: 1649
Posted 12:27 Mar 21, 2019 |

I've started a document describing some of Python's notational curiosities.  This is only a beginning. (For example, the ** notation needs discussion and examples.) Let me know what else should be added or mistakes you find.

Last edited by rabbott at 13:38 Mar 21, 2019.
asalin14
Posts: 12
Posted 12:57 Mar 21, 2019 |

Great write up! 

It might be too simple but you can also include the notation:

x = [1,2,3] # or (1,2,3)

a, b, c = x

I expected d, e, f = *x but that results in a syntax error.

You can, however, convert arrays to tuples or tuples to arrays using the * notation.

a = [1,2,3]

b = (*a,) # (1,2,3)

c = [*b] # [1,2,3]

Last edited by asalin14 at 12:59 Mar 21, 2019.