Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a168d9

Browse files
committed
Add example for __wrapped__.
1 parent f1dae31 commit 7a168d9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Doc/whatsnew/3.2.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,11 @@ functools
736736
it also gracefully skips over missing attributes such as :attr:`__doc__` which
737737
might not be defined for the wrapped callable.
738738

739+
In the above example, the cache can be removed by recovering the original
740+
function:
741+
742+
>>> get_phone_number = get_phone_number.__wrapped__ # uncached function
743+
739744
(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and
740745
:issue:`8814`.)
741746

@@ -943,10 +948,14 @@ datetime and time
943948
:attr:`time.accept2dyear` be set to *False* so that large date ranges
944949
can be used without guesswork:
945950

946-
>>> time.accept2dyear = 1 # guess whether 11 means 11 or 2011
951+
>>> warnings.resetwarnings() # remove the default warning filters
952+
>>> time.accept2dyear = True # guess whether 11 means 11 or 2011
947953
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
954+
Warning (from warnings module):
955+
...
956+
DeprecationWarning: Century info guessed for a 2-digit year.
948957
'Fri Jan 1 12:34:56 2011'
949-
>>> time.accept2dyear = 0 # use the full range of allowable dates
958+
>>> time.accept2dyear = False # use the full range of allowable dates
950959
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
951960
'Fri Jan 1 12:34:56 11'
952961

0 commit comments

Comments
 (0)