I see no reason to introduce clutter like this at this point in time - code needing to run in both Py 2 nd 3, if not using something like "six" could do:
compat.py try: unicode except NameError: unicode = basestring = str elsewhere: from compat import unicode, basestring Or rather: try: unicode else: str = basestring = unicode and from compat import str # therefore having Python3 valid and clear code from here. On 3 March 2017 at 11:37, Ryan Birmingham <rainventi...@gmail.com> wrote: > The thread is here in the archive > (https://mail.python.org/pipermail/python-ideas/2016-June/040761.html) if > anyone's wondering context, as I was. > > In short, someone wanted an alias from string to basestring. > This is addressed in the "What's new in Python 3.0" > (https://docs.python.org/3/whatsnew/3.0.html) page: >> >> The built-in basestring abstract type was removed. Use str instead. The >> strand bytes types don’t have functionality enough in common to warrant a >> shared base class. The 2to3 tool (see below) replaces every occurrence of >> basestring with str. > > Personally, I have no issue with leaving an alias like this in 2to3, since > adding it to the language feels more like forced backwards compatibility to > me. > > That said, there are more related subtleties on the "What's new in Python > 3.0" page, some of which seem less intuitive, so I understand where a desire > like this would come from. Would more specific and succinct documentation on > this change alone help? > > -Ryan Birmingham > > On 3 March 2017 at 06:44, Thomas Güttler <guettl...@thomas-guettler.de> > wrote: >> >> I found this in an old post: >> >> > Maybe too late now but there should have been 'unicode', >> > 'basestring' as aliases for 'str'. >> >> I guess it is too late to think about it again ... >> >> Regards, >> Thomas Güttler >> >> >> -- >> Thomas Guettler http://www.thomas-guettler.de/ >> _______________________________________________ >> Python-ideas mailing list >> Python-ideas@python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ > > > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/