File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +0
-27
lines changed
Original file line number Diff line number Diff line change @@ -569,33 +569,6 @@ files for you.
569
569
The ``with `` statement is better because it will ensure you always close the
570
570
file, even if an exception is raised.
571
571
572
- Returning Multiple Values from a Function
573
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
574
-
575
- Python supports returning multiple values from a function as a comma-separated
576
- list, so you don't have to create an object or dictionary and pack multiple
577
- values in before you return
578
-
579
- **Bad **:
580
-
581
- .. code-block :: python
582
-
583
- def math_func (a ):
584
- return {' square' : a ** 2 , ' cube' : a ** 3 }
585
-
586
- d = math_func(3 )
587
- s = d[' square' ]
588
- c = d[' cube' ]
589
-
590
- **Good **:
591
-
592
- .. code-block :: python
593
-
594
- def math_func (a ):
595
- return a ** 2 , a ** 3
596
-
597
- square, cube = math_func(3 )
598
-
599
572
Line Continuations
600
573
~~~~~~~~~~~~~~~~~~
601
574
You can’t perform that action at this time.
0 commit comments