Changes between Version 60 and Version 61 of DeveloperGuidelines/Py_2_3


Ignore:
Timestamp:
07/05/19 23:23:07 (5 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Py_2_3

    v60 v61  
    239239If you just want to encode a potential {{{unicode}}} instance as an utf-8 encoded {{{str}}}, use {{{s3_str}}} rather than {{{unicode.encode}}}:
    240240{{{#!python
    241 # Do this instead (without type-check):
     241# Do this instead:
    242242x = s3_str(x)
    243243}}}
    244244
    245 Though, if you want to exclude other types, you can still use {{{basestring}}} for type-checking:
    246 {{{#!python
    247 if isinstance(x, basestring):
     245If you need to exclude non-string types from the conversion, you can keep the type-check:
     246{{{#!python
     247if isinstance(x, unicodeT):
    248248    x = s3_str(x)
    249249}}}