Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python parentheses

1. We use parentheses as the call operator to invoke functions.
2. Similarly to functions, classes are also callable. By calling a class, we’re creating an instance object of the class.
3. When we define classes, we use parentheses to indicate what the superclass is for the current class. The relationship between subclasses and superclasses is called inheritance.
4. Parentheses are closely related to denote the values for the built-in data type — tuples. One important thing to remember is that we need to include a comma following the element if we’re creating a one-element tuple.
5. Unlike list comprehension, which uses square brackets, generator expression uses a pair of parentheses, although both techniques have the same expression within the square brackets or parentheses.
Source by codingfordata.com #
 
PREVIOUS NEXT
Tagged: #python #parentheses
ADD COMMENT
Topic
Name
5+6 =