Changes between Version 28 and Version 29 of DeveloperGuidelines/Py_2_3


Ignore:
Timestamp:
06/28/19 08:44:33 (5 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Py_2_3

    v28 v29  
    9999The following objects are provided by s3compat:
    100100
    101 ||= '''Name''' =||= '''Import''' =||= '''!Comments/Caveats''' =||
    102 ||PY2||{{{from s3compat import PY2}}}||Constant indicating whether we're currently running on Py2, should only be used if alternatives cannot be generalized||
    103 ||StringIO||{{{from s3compat import StringIO}}}|| ||
    104 ||pickle||{{{from s3compat import pickle}}}||replaces cPickle in Py2||
    105 ||basestring||{{{from s3compat import basestring}}}|| ||
    106 ||unichr||{{{from s3compat import unichr}}}|| ||
    107 ||STRING_TYPES||{{{from s3compat import STRING_TYPES}}}||maps to tuple of all known string types: (str,unicode) in Py2, (str,) in Py3, for type checking||
    108 ||long||{{{from s3compat import long}}}||same as {{{int}}} in Py3, so can occasionally lead to redundancy||
    109 ||INTEGER_TYPES||{{{from s3compat import INTEGER_TYPES}}}||maps to tuple of all known integer types: (int,long) in Py2, (int,) in Py3, for use with {{{isinstance}}}||
    110 ||urllib2||{{{from s3compat import urllib2}}}||maps to urllib.requests in Py3, which contains only part of Py2's urllib2 - some urllib2 objects therefore need to be imported separately (see below)||
    111 ||HTTPError||{{{from s3compat import HTTPError}}}||replaces urllib2.HTTPError in Py2||
    112 ||urlopen||{{{from s3compat import urlopen}}}||replaces urllib.urlopen and urllib2.urlopen in Py2||
    113 ||urlencode||{{{from s3compat import urlencode}}}||replaces urllib.urlencode in Py2||
    114 ||HTMLParser||{{{from s3compat import HTMLParser}}}||replaces HTMLParser.HTMLParser in Py2||
     101||= '''Name''' =||= '''Type''' =||= '''Import''' =||= '''!Comments/Caveats''' =||
     102||PY2||{{{from s3compat import PY2}}}||boolean||Constant indicating whether we're currently running on Py2, should only be used if alternatives cannot be generalized||
     103||StringIO||class||{{{from s3compat import StringIO}}}|| ||
     104||pickle||module||{{{from s3compat import pickle}}}||replaces cPickle in Py2||
     105||basestring||type||{{{from s3compat import basestring}}}|| ||
     106||unichr||function||{{{from s3compat import unichr}}}|| ||
     107||STRING_TYPES||type tuple||{{{from s3compat import STRING_TYPES}}}||maps to tuple of all known string types: (str,unicode) in Py2, (str,) in Py3, for type checking||
     108||long||type||{{{from s3compat import long}}}||same as {{{int}}} in Py3, so can occasionally lead to redundancy||
     109||INTEGER_TYPES||type tuple||{{{from s3compat import INTEGER_TYPES}}}||maps to tuple of all known integer types: (int,long) in Py2, (int,) in Py3, for use with {{{isinstance}}}||
     110||urlparse||module||{{{from s3compat import urlparse}}}||maps to urllib.parse in Py3||
     111||urllib2||module||{{{from s3compat import urllib2}}}||maps to urllib.requests in Py3, which contains only part of Py2's urllib2 - some urllib2 objects therefore need to be imported separately (see below)||
     112||HTTPError||class||{{{from s3compat import HTTPError}}}||replaces urllib2.HTTPError in Py2||
     113||urlopen||function||{{{from s3compat import urlopen}}}||replaces urllib.urlopen and urllib2.urlopen in Py2||
     114||urlencode||function||{{{from s3compat import urlencode}}}||replaces urllib.urlencode in Py2||
     115||HTMLParser||class||{{{from s3compat import HTMLParser}}}||replaces HTMLParser.HTMLParser in Py2||
    115116
    116117