diff --git a/README.md b/README.md index 1bccbb9..b9db1ef 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ value = .setdefault(key, default=None) # Same, but also adds default to ``` ```python -value = .pop(key) # Removes item from dictionary. +value = .pop(key) # Removes item or raises KeyError. {k: v for k, v in .items() if k in keys} # Filters dictionary by keys. ``` @@ -354,6 +354,7 @@ import re = re.finditer(, text) # Returns all occurrences as match objects. ``` +* **Search() and match() return None if there are no matches.** * **Argument `'flags=re.IGNORECASE'` can be used with all functions.** * **Argument `'flags=re.MULTILINE'` makes `'^'` and `'$'` match the start/end of each line.** * **Argument `'flags=re.DOTALL'` makes dot also accept newline.** @@ -610,7 +611,7 @@ from dateutil.tz import UTC, tzlocal, gettz ```python = UTC # UTC timezone. London without DST. = tzlocal() # Local timezone. Also gettz(). - = gettz('/') # Timezone from 'Continent/City_Name' str. + = gettz('/') # 'Continent/City_Name' timezone or None. ``` ```python @@ -620,7 +621,7 @@ from dateutil.tz import UTC, tzlocal, gettz ### Encode ```python - = D/T/DT.fromisoformat('') # Object from ISO string. + = D/T/DT.fromisoformat('') # Object from ISO string. Raises ValueError.
= DT.strptime(, '') # Datetime from str, according to format. = D/DT.fromordinal() # D/DTn from days since Christ, at midnight. = DT.fromtimestamp() # Local time DTn from seconds since Epoch. @@ -1296,9 +1297,9 @@ class (Enum): ```python - = . - = [''] - = () + = . # Returns a member. + = [''] # Returns a member or raises KeyError. + = () # Returns a member or raises ValueError. name = .name value = .value ``` diff --git a/index.html b/index.html index 950ad3e..067a49d 100644 --- a/index.html +++ b/index.html @@ -271,7 +271,7 @@ value = <dict>.setdefault(key, default=None# Creates a dict from two collections. <dict> = dict.fromkeys(keys [, value]) # Creates a dict from collection of keys. -
value = <dict>.pop(key)                         # Removes item from dictionary.
+
value = <dict>.pop(key)                         # Removes item or raises KeyError.
 {k: v for k, v in <dict>.items() if k in keys}  # Filters dictionary by keys.
 

Counter

>>> from collections import Counter
@@ -459,6 +459,7 @@ to_exclusive   = <range>.stop
 
    +
  • Search() and match() return None if there are no matches.
  • Argument 'flags=re.IGNORECASE' can be used with all functions.
  • Argument 'flags=re.MULTILINE' makes '^' and '$' match the start/end of each line.
  • Argument 'flags=re.DOTALL' makes dot also accept newline.
  • @@ -660,14 +661,14 @@ shuffle(<list>)

Timezone

<tzinfo> = UTC                              # UTC timezone. London without DST.
 <tzinfo> = tzlocal()                        # Local timezone. Also gettz().
-<tzinfo> = gettz('<Cont.>/<City>')          # Timezone from 'Continent/City_Name' str.
+<tzinfo> = gettz('<Cont.>/<City>')          # 'Continent/City_Name' timezone or None.
 
<DTa>    = <DT>.astimezone(<tzinfo>)        # Datetime, converted to passed timezone.
 <Ta/DTa> = <T/DT>.replace(tzinfo=<tzinfo>)  # Unconverted object with new timezone.
 
-

Encode

<D/T/DT> = D/T/DT.fromisoformat('<iso>')    # Object from ISO string.
-<DT>     = DT.strptime(<str>, '<format>')   # Datetime from str, according to format.
+

Encode

<D/T/DT> = D/T/DT.fromisoformat('<iso>')    # Object from ISO string. Raises ValueError.
+<DT>     = DT.strptime(<str>, '<format>')   # Datetime from str, according to format. 
 <D/DTn>  = D/DT.fromordinal(<int>)          # D/DTn from days since Christ, at midnight.
 <DTn>    = DT.fromtimestamp(<real>)         # Local time DTn from seconds since Epoch.
 <DTa>    = DT.fromtimestamp(<real>, <tz.>)  # Aware datetime from seconds since Epoch.
@@ -1218,9 +1219,9 @@ lock = threading.RLock(); with lock: ...
 
  • If there are no numeric values before auto(), it returns 1.
  • Otherwise it returns an increment of last numeric value.
  • -
    <member> = <enum>.<member_name>
    -<member> = <enum>['<member_name>']
    -<member> = <enum>(<value>)
    +
    <member> = <enum>.<member_name>                # Returns a member.
    +<member> = <enum>['<member_name>']             # Returns a member or raises KeyError.
    +<member> = <enum>(<value>)                     # Returns a member or raises ValueError.
     name     = <member>.name
     value    = <member>.value