Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Shiz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Guido van Rossum wrote: > Well, it really does look like checking for the presence of those > ANDROID_* environment variables it the best way to recognize the > Android platform. Anyone can do that without waiting for a ruling on > whether Android i

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Guido van Rossum
Well, it really does look like checking for the presence of those ANDROID_* environment variables it the best way to recognize the Android platform. Anyone can do that without waiting for a ruling on whether Android is Linux or not (which would be necessary because the docs for sys.platform are qui

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Greg Ewing
Shiz wrote: I'm not sure a check to see if e.g. /system exists is really enough to conclude Python is running on Android on its own. Since MacOSX has /System and typically a case-insensitive file system, it certainly wouldn't. :-) -- Greg ___ Python-

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Shiz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Guido van Rossum wrote: > Can you give a few examples of where you'd need to differentiate > Android from other Linux platforms in otherwise portable code, and > where testing for the presence or absence of the specific function > that you'd like to

Re: [Python-Dev] [Python-checkins] cpython: Issue #22003: When initialized from a bytes object, io.BytesIO() now

2014-08-02 Thread David Wilson
Thanks for spotting, There is a new patch in http://bugs.python.org/issue22125 to fix the warnings. David ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailma

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Guido van Rossum
On Sat, Aug 2, 2014 at 12:14 PM, Shiz wrote: > Guido van Rossum wrote: > > sys.platform is for a broad indication of the OS kernel. It can be > > used to distinguish Windows, Mac and Linux (and BSD, Solaris etc.). > > Since Android is Linux it should have the same sys.platform as other > > Linux

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Guido van Rossum
Right. On Saturday, August 2, 2014, Phil Thompson wrote: > On 02/08/2014 7:36 pm, Guido van Rossum wrote: > >> On Sat, Aug 2, 2014 at 12:53 AM, Phil Thompson < >> p...@riverbankcomputing.com> >> wrote: >> >> To me the issue is whether, for a particular value of sys.platform, the >>> programmer

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Phil Thompson
On 02/08/2014 7:36 pm, Guido van Rossum wrote: On Sat, Aug 2, 2014 at 12:53 AM, Phil Thompson wrote: To me the issue is whether, for a particular value of sys.platform, the programmer can expect a particular Python stdlib API. If so then Android needs a different value for sys.platform.

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread David Wilson
On Sat, Aug 02, 2014 at 05:39:12PM +1000, Steven D'Aprano wrote: > Repeated list and str concatenation both have quadratic O(N**2) > performance, but people frequently build up strings with + and rarely > do the same for lists. String concatenation with + is an attractive > nuisance for many peopl

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Shiz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Guido van Rossum wrote: > sys.platform is for a broad indication of the OS kernel. It can be > used to distinguish Windows, Mac and Linux (and BSD, Solaris etc.). > Since Android is Linux it should have the same sys.platform as other > Linux systems

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Guido van Rossum
On Sat, Aug 2, 2014 at 12:53 AM, Phil Thompson wrote: > To me the issue is whether, for a particular value of sys.platform, the > programmer can expect a particular Python stdlib API. If so then Android > needs a different value for sys.platform. > sys.platform is for a broad indication of the O

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Alexander Belopolsky
On Sat, Aug 2, 2014 at 11:06 AM, Stefan Behnel wrote: > I don't think sum(strings) is beautiful enough sum(strings) is more beautiful than ''.join(strings) in my view, but unfortunately it does not work even for lists because the initial value defaults to 0. sum(strings, '') and ''.join(string

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread MRAB
On 2014-08-02 16:27, Steven D'Aprano wrote: On Sat, Aug 02, 2014 at 10:52:07AM -0400, Alexander Belopolsky wrote: On Sat, Aug 2, 2014 at 3:39 AM, Steven D'Aprano wrote: > String concatenation with + is an attractive > nuisance for many people, including some who actually know better but > neve

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Shiz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Akira Li wrote: > Python uses os.name, sys.platform, and various functions from > `platform` module to provide version info: > > - coarse: os.name is 'posix', 'nt', 'ce', 'java' [1]. It is defined > by availability of some builtin modules ('posix',

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Steven D'Aprano
On Sat, Aug 02, 2014 at 10:52:07AM -0400, Alexander Belopolsky wrote: > On Sat, Aug 2, 2014 at 3:39 AM, Steven D'Aprano wrote: > > > String concatenation with + is an attractive > > nuisance for many people, including some who actually know better but > > nevertheless do it. Also, for reasons I d

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Stefan Behnel
Alexander Belopolsky schrieb am 02.08.2014 um 16:52: > On Sat, Aug 2, 2014 at 3:39 AM, Steven D'Aprano wrote: > >> String concatenation with + is an attractive >> nuisance for many people, including some who actually know better but >> nevertheless do it. Also, for reasons I don't understand, many

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Alexander Belopolsky
On Sat, Aug 2, 2014 at 3:39 AM, Steven D'Aprano wrote: > String concatenation with + is an attractive > nuisance for many people, including some who actually know better but > nevertheless do it. Also, for reasons I don't understand, many people > dislike or cannot remember to use ''.join. > Sin

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Stefan Behnel
Julian Taylor schrieb am 02.08.2014 um 12:11: > On 02.08.2014 08:35, Terry Reedy wrote: >> On 8/2/2014 1:57 AM, Allen Li wrote: >>> On Fri, Aug 01, 2014 at 02:51:54PM -0700, Guido van Rossum wrote: No. We just can't put all possible use cases in the docstring. :-) On Fri, Aug 1,

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Julian Taylor
On 02.08.2014 08:35, Terry Reedy wrote: > On 8/2/2014 1:57 AM, Allen Li wrote: >> On Fri, Aug 01, 2014 at 02:51:54PM -0700, Guido van Rossum wrote: >>> No. We just can't put all possible use cases in the docstring. :-) >>> >>> >>> On Fri, Aug 1, 2014 at 2:48 PM, Andrea Griffini wrote: >>> >>>

Re: [Python-Dev] sum(...) limitation

2014-08-02 Thread Steven D'Aprano
On Fri, Aug 01, 2014 at 10:57:38PM -0700, Allen Li wrote: > On Fri, Aug 01, 2014 at 02:51:54PM -0700, Guido van Rossum wrote: > > No. We just can't put all possible use cases in the docstring. :-) > > > > > > On Fri, Aug 1, 2014 at 2:48 PM, Andrea Griffini wrote: > > > > help(sum) tells cle

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-02 Thread Phil Thompson
On 02/08/2014 4:34 am, Guido van Rossum wrote: Or SL4A? (https://github.com/damonkohler/sl4a) On Fri, Aug 1, 2014 at 8:06 PM, Steven D'Aprano wrote: On Sat, Aug 02, 2014 at 05:53:45AM +0400, Akira Li wrote: > Python uses os.name, sys.platform, and various functions from `platform` > modul