[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    Re: [Python-Dev]
From:       Vinay Sajip <vinay_sajip () yahoo ! co ! uk>
Date:       2011-05-28 14:57:15
Message-ID: loom.20110528T164222-362 () post ! gmane ! org
[Download RAW message or body]

Victor Stinner <victor.stinner <at> haypocalc.com> writes:

> It's difficult for an user to choose between between open() and 
> codecs.open().

Is it? How about the following decision process?

If writing code for Python 3.x only, use open().

If writing code which has to work under both Python 2.x and 3.x, use
codecs.open().

BTW I have written code using StreamReader and StreamWriter in the past,
though it may not have been published on the Internet. Python is used a
lot by companies for internal systems. Such code is seldom published on the
Internet, so it seems that there's no real way of knowing how much
StreamReader/StreamWriter are used.

When looking at porting projects to Python 3.x, I've always adopted a single
code-base approach for 2.x and 3.x, as I feel it's the path of least ongoing
maintenance and hence (in my experience) the path of least resistance to
providing 3.x support. Though of course I've no objection to implementing their
functionality in the most efficient way possible (which may well be
TextIOWrapper), IMO deprecating StreamReader/StreamWriter will make 2.x/3.x
portability harder to achieve, and so seems a step too far.

Regards,

Vinay Sajip

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic