This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Decorater
Recipients Decorater
Date 2016-09-10.23:27:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473550050.32.0.541493400978.issue28072@psf.upfronthosting.co.za>
In-reply-to
Content
I noticed that the Python interpreter does not interpret a empty string as None so I have to do this unclean workaround every time in functions that cannot have a empty string passed to them.

Here is some example Code I have to do to bypass this (the function itself):

def create_one(url):
    if url == '':
        url = None
    if url is not None:
        url_data = urllib.parse.urlencode(dict(url=url))
        byte_data = str.encode(url_data)
        ret = urllib.request.urlopen(API_CREATE, data=byte_data).read().strip()
        almost_result = str(ret)
        closer_result = almost_result.strip("b")
        result = closer_result.strip("'")
        return result
    else:
        URLError('The given URL Cannot be \'None\'.')

So yeah I suggest for the interpreter to interpret empty strings as None so that way it can cleanup some lines of trying to parse it to None which can be a lot of work. It also makes code simpler as well.
History
Date User Action Args
2016-09-10 23:27:30Decoratersetrecipients: + Decorater
2016-09-10 23:27:30Decoratersetmessageid: <1473550050.32.0.541493400978.issue28072@psf.upfronthosting.co.za>
2016-09-10 23:27:30Decoraterlinkissue28072 messages
2016-09-10 23:27:30Decoratercreate