|
639 | 639 | </code></pre>
|
640 | 640 | <div><h2 id="datetime"><a href="#datetime" name="datetime">#</a>Datetime</h2><ul>
|
641 | 641 | <li><strong>Module 'datetime' provides 'date' <code class="apache hljs"><span class="hljs-section"><D></span></code>, 'time' <code class="apache hljs"><span class="hljs-section"><T></span></code>, 'datetime' <code class="apache hljs"><span class="hljs-section"><DT></span></code> and 'timedelta' <code class="apache hljs"><span class="hljs-section"><TD></span></code> classes. All are immutable and hashable.</strong></li>
|
642 |
| -<li><strong>Time and datetime can be 'aware' <code class="apache hljs"><span class="hljs-section"><a></span></code>, meaning they have defined timezone, or 'naive' <code class="apache hljs"><span class="hljs-section"><n></span></code>, meaning they don't.</strong></li> |
| 642 | +<li><strong>Time and datetime objects can be 'aware' <code class="apache hljs"><span class="hljs-section"><a></span></code>, meaning they have defined timezone, or 'naive' <code class="apache hljs"><span class="hljs-section"><n></span></code>, meaning they don't.</strong></li> |
643 | 643 | <li><strong>If object is naive, it is presumed to be in the system's timezone.</strong></li>
|
644 | 644 | </ul><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> datetime <span class="hljs-keyword">import</span> date, time, datetime, timedelta
|
645 | 645 | <span class="hljs-keyword">from</span> dateutil.tz <span class="hljs-keyword">import</span> UTC, tzlocal, gettz, resolve_imaginary
|
|
1194 | 1194 | <div><h3 id="collectionsabcsequence">Collections.abc.Sequence</h3><ul>
|
1195 | 1195 | <li><strong>It's a richer interface than the basic sequence.</strong></li>
|
1196 | 1196 | <li><strong>Extending it generates iter(), contains(), reversed(), index(), and count().</strong></li>
|
1197 |
| -<li><strong>Unlike <code class="python hljs"><span class="hljs-string">'abc.Iterable'</span></code> and <code class="python hljs"><span class="hljs-string">'abc.Collection'</span></code>, it is not a duck type. That is why <code class="python hljs"><span class="hljs-string">'issubclass(MySequence, collections.abc.Sequence)'</span></code> would return False even if MySequence had all the methods defined.</strong></li> |
| 1197 | +<li><strong>Unlike <code class="python hljs"><span class="hljs-string">'abc.Iterable'</span></code> and <code class="python hljs"><span class="hljs-string">'abc.Collection'</span></code>, it is not a duck type. That is why <code class="python hljs"><span class="hljs-string">'issubclass(MySequence, abc.Sequence)'</span></code> would return False even if MySequence had all the methods defined.</strong></li> |
1198 | 1198 | </ul><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> abc
|
1199 | 1199 |
|
1200 | 1200 | <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyAbcSequence</span><span class="hljs-params">(abc.Sequence)</span>:</span>
|
|
0 commit comments