-2

I have a line of code from Python forbidden fruit module:

__all__ = 'curse', 'curses', 'reverse'

I know what strings are and I know what arrays and tuples are. What kind of variable is this? How can we use this and for what?

7
  • 7
    It's a tuple. Tuples are defined by commas, not parentheses. Commented Jan 11, 2018 at 18:16
  • possible dup : stackoverflow.com/questions/44834/… Commented Jan 11, 2018 at 18:16
  • @IMCoins: No, that's about the special variable __all__, and says nothing about the syntax used here. Commented Jan 11, 2018 at 18:17
  • 3
    Terminology nitpick: while Python does have arrays, they are rarely used compared to the far more common built-in data type, list. If you're reading a tutorial that calls [1,2,3] an array, find a new tutorial. Commented Jan 11, 2018 at 18:17
  • @MartijnPieters I understand, but he could have selected ANY variable, and he chose this specific one. That sounds more than a coincidence to me. Like : He wanted to know what __all__ was, since he already said "I know what a tuple is". :) his question might be poorly formulated, but I believe I got it right -- EDIT : Correct me if I'm wrong though. Commented Jan 11, 2018 at 18:19

1 Answer 1

3

It's a tuple. If you want to find out the type of something, use the type function - e.g.

type(__all__)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.