Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Random832
On Thu, Sep 8, 2016, at 16:01, Chris Barker wrote:
> Is there a "long" in there anywhere in the integer implementation?

The python 2 long type is the python 3 int type. The python 2 int type
is gone.

> I don't have py3 running on win64 anywhere right now, but in win64 py2,
> that would give you:
> 
> dtype('int32')
> 
> as it's a "long" under the hood

That's numpy's decision, there's nothing "built-in" about it.

> (and I'm pretty sure that is not because of numpy code itself, but rather
> how Cpython is written/compiled)

Nope.
https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/common.c#L105

Note that PyInt_Check doesn't exist anymore in Python 3. NumPy provides
its own definition:

https://github.com/numpy/numpy/blob/master/numpy/core/include/numpy/npy_3kcompat.h#L35
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Guido van Rossum
Can you guys get a room? There is absolutely no reason that all of
python-dev needs to hear this.

On Thu, Sep 8, 2016 at 1:35 PM, Steve Dower  wrote:
> On 08Sep2016 1301, Chris Barker wrote:
>>
>> On Thu, Sep 8, 2016 at 9:39 AM, Random832 > > wrote:
>>
>> You're talking about changing Py_ssize_t, right?
>>
>>
>> wouldn't that be the pointer size?
>>
>> Is there a "long" in there anywhere in the integer implementation?
>> [SNIP]
>> Does py3 already use int64?
>
>
> Py3 has used a variable-length int representation for its entire existence.
>
> Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
 2**1000
> 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
>
> Cheers,
> Steve
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org



-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Steve Dower

On 08Sep2016 1301, Chris Barker wrote:

On Thu, Sep 8, 2016 at 9:39 AM, Random832 > wrote:

You're talking about changing Py_ssize_t, right?


wouldn't that be the pointer size?

Is there a "long" in there anywhere in the integer implementation?
[SNIP]
Does py3 already use int64?


Py3 has used a variable-length int representation for its entire existence.

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit 
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> 2**1000
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376

Cheers,
Steve
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Chris Barker
On Thu, Sep 8, 2016 at 9:39 AM, Random832  wrote:

> You're talking about changing Py_ssize_t, right?
>

wouldn't that be the pointer size?

Is there a "long" in there anywhere in the integer implementation?

My example is this:

on OS-X, py3.5:

import numpy as np

In [9]: arr = np.array([1,2,3])

Out[10]: array([1, 2, 3])

In [11]: arr.dtype

Out[11]: dtype('int64')

I don't have py3 running on win64 anywhere right now, but in win64 py2,
that would give you:

dtype('int32')

as it's a "long" under the hood

(and I'm pretty sure that is not because of numpy code itself, but rather
how Cpython is written/compiled)

Does py3 already use int64?

-CHB



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Chris Angelico
On Fri, Sep 9, 2016 at 2:39 AM, Random832  wrote:
> On Thu, Sep 8, 2016, at 12:30, Chris Barker wrote:
>> That's why I said "based on" -- under the hood, a C type is used, and
>> IIUC, that type has been "long" for ages. And a long on Windows 64
>> (with the MS compiler anyway) is 32 bit, and a long on *nix (with the
>> gnu compilers, at least) is 64 bits.
>>
>> This doesn't expose itself to pure python (and sys.maxint is now gone)
>> but it does get exposed in the C API, and in particular, when passing
>> data back and forth between numpy and pure python (numpy doesn't
>> support an unlimited integer like python), or working with buffers or
>> bytearrays, or whatever in Cython.
>
> I'm not sure "the builtin integer type" was the right term for what
> you're referring to.
>
> You're talking about changing Py_ssize_t, right?

There are a few places where the size of ssize_t becomes visible to a
Python script.

Python 3.6.0a4+ (default:4b64a049f451+, Aug 19 2016, 23:41:43)
[GCC 6.1.1 20160802] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x=1<<(1<<30)
>>> x=1<<(1<<34)
>>> x=1<<(1<<62)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> x=1<<(1<<66)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C ssize_t

But I got the same result on 3.5.2 on Win 7 64-bit, so I'm not seeing
a difference here - it seems that PyLong_AsSsize_t has the same limits
on both platforms.

ChrisA
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Random832
On Thu, Sep 8, 2016, at 12:30, Chris Barker wrote:
> That's why I said "based on" -- under the hood, a C type is used, and
> IIUC, that type has been "long" for ages. And a long on Windows 64
> (with the MS compiler anyway) is 32 bit, and a long on *nix (with the
> gnu compilers, at least) is 64 bits.
>
> This doesn't expose itself to pure python (and sys.maxint is now gone)
> but it does get exposed in the C API, and in particular, when passing
> data back and forth between numpy and pure python (numpy doesn't
> support an unlimited integer like python), or working with buffers or
> bytearrays, or whatever in Cython.

I'm not sure "the builtin integer type" was the right term for what
you're referring to.

You're talking about changing Py_ssize_t, right?
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Chris Barker
On Thu, Sep 8, 2016 at 9:17 AM, Benjamin Peterson 
wrote:

> > Does this mean that we might be able to have the built-in integer be
> > based
> > on int64_t now? so Windows64 and *nix64 will be the same?
>
> The builtin integer type (in Python 3) is variable length.
>

indeed it is -- py2.7 also??

That's why I said "based on" -- under the hood, a C type is used, and IIUC,
that type has been "long" for ages. And a long on Windows 64 (with the MS
 compiler anyway) is 32 bit, and a long on *nix (with the gnu compilers, at
least) is 64 bits.

This doesn't expose itself to pure python (and sys.maxint is now gone) but
it does get exposed in the C API, and in particular, when passing data back
and forth between numpy and pure python (numpy doesn't support an unlimited
integer like python), or working with buffers or bytearrays, or whatever in
Cython.

Perhaps this is now a non-issue in py3 -- I honestly have not done any
"real" computation work with py3 yet, but it sure is in 2.7

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Benjamin Peterson


On Thu, Sep 8, 2016, at 09:09, Chris Barker wrote:
> > > - Standard integer types in  and 
> >
> 
> 
> > Yes, I will clarify we require the fixed-width types.
> 
> 
> Does this mean that we might be able to have the built-in integer be
> based
> on int64_t now? so Windows64 and *nix64 will be the same?

The builtin integer type (in Python 3) is variable length.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-08 Thread Chris Barker
> > - Standard integer types in  and 
>


> Yes, I will clarify we require the fixed-width types.


Does this mean that we might be able to have the built-in integer be based
on int64_t now? so Windows64 and *nix64 will be the same?

- CHB



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Benjamin Peterson


On Wed, Sep 7, 2016, at 15:58, Martin Panter wrote:
> Thank you very much Benjamin.
> 
> On 7 September 2016 at 17:56, Benjamin Peterson 
> wrote:
> > To conclude our discussion about using C99 features, I've updated PEP 7
> > to allow the following features:
> > - Standard integer types in  and 
> 
> Perhaps PEP 7 should clarify if the optional types like uint32_t are
> allowed, or only C99 mandatory types like uint_fast32_t etc. I think
> more people will be familiar with the fixed-width uint32_t etc. I know
> they are mandatory in Posix, and presumably also Windows, so they may
> be okay.

Yes, I will clarify we require the fixed-width types.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Martin Panter
Thank you very much Benjamin.

On 7 September 2016 at 17:56, Benjamin Peterson  wrote:
> To conclude our discussion about using C99 features, I've updated PEP 7
> to allow the following features:
> - Standard integer types in  and 

Perhaps PEP 7 should clarify if the optional types like uint32_t are
allowed, or only C99 mandatory types like uint_fast32_t etc. I think
more people will be familiar with the fixed-width uint32_t etc. I know
they are mandatory in Posix, and presumably also Windows, so they may
be okay.

> - ``static inline`` functions
> - designated initializers
> - intermingled declarations
> - booleans
>
> I've been adding examples of these to 3.6 over the last few days to make
> sure the buildbots will like it.
>
> https://github.com/python/peps/commit/b6efe6e06fa70e8933440da26474a804fb3edb6e
>
> Enjoy.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Benjamin Peterson
One more thing I forgot: C++-style line comments are kosher, too.

On Wed, Sep 7, 2016, at 10:56, Benjamin Peterson wrote:
> To conclude our discussion about using C99 features, I've updated PEP 7
> to allow the following features:
> - Standard integer types in  and 
> - ``static inline`` functions
> - designated initializers
> - intermingled declarations
> - booleans
> 
> I've been adding examples of these to 3.6 over the last few days to make
> sure the buildbots will like it.
> 
> https://github.com/python/peps/commit/b6efe6e06fa70e8933440da26474a804fb3edb6e
> 
> Enjoy.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Ryan Gonzalez
Wonder if it's ever segfaulted...

...hey, I just figured out why we got Python 3! ;)

--
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/
On Sep 7, 2016 2:02 PM, "Antoine Pitrou"  wrote:

> On Wed, 7 Sep 2016 11:53:14 -0700
> Guido van Rossum  wrote:
> > W00t! I will have to rewrite my brain. :-)
>
> ... Is your brain coded in C89?
>
>
> >
> > On Wed, Sep 7, 2016 at 11:07 AM, Victor Stinner
> >  wrote:
> > > 2016-09-07 10:56 GMT-07:00 Benjamin Peterson :
> > >> To conclude our discussion about using C99 features, I've updated PEP
> 7
> > >> to allow the following features:
> > >> - Standard integer types in  and 
> > >> - ``static inline`` functions
> > >> - designated initializers
> > >> - intermingled declarations
> > >> - booleans
> > >
> > > Welcome to the future!
> > >
> > > Victor
> > > ___
> > > Python-Dev mailing list
> > > Python-Dev@python.org
> > > https://mail.python.org/mailman/listinfo/python-dev
> > > Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
> >
> >
> >
>
>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> rymg19%40gmail.com
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Antoine Pitrou
On Wed, 7 Sep 2016 11:53:14 -0700
Guido van Rossum  wrote:
> W00t! I will have to rewrite my brain. :-)

... Is your brain coded in C89?


> 
> On Wed, Sep 7, 2016 at 11:07 AM, Victor Stinner
>  wrote:
> > 2016-09-07 10:56 GMT-07:00 Benjamin Peterson :  
> >> To conclude our discussion about using C99 features, I've updated PEP 7
> >> to allow the following features:
> >> - Standard integer types in  and 
> >> - ``static inline`` functions
> >> - designated initializers
> >> - intermingled declarations
> >> - booleans  
> >
> > Welcome to the future!
> >
> > Victor
> > ___
> > Python-Dev mailing list
> > Python-Dev@python.org
> > https://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe: 
> > https://mail.python.org/mailman/options/python-dev/guido%40python.org  
> 
> 
> 



___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Guido van Rossum
W00t! I will have to rewrite my brain. :-)

On Wed, Sep 7, 2016 at 11:07 AM, Victor Stinner
 wrote:
> 2016-09-07 10:56 GMT-07:00 Benjamin Peterson :
>> To conclude our discussion about using C99 features, I've updated PEP 7
>> to allow the following features:
>> - Standard integer types in  and 
>> - ``static inline`` functions
>> - designated initializers
>> - intermingled declarations
>> - booleans
>
> Welcome to the future!
>
> Victor
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/guido%40python.org



-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (some) C99 added to PEP 7

2016-09-07 Thread Victor Stinner
2016-09-07 10:56 GMT-07:00 Benjamin Peterson :
> To conclude our discussion about using C99 features, I've updated PEP 7
> to allow the following features:
> - Standard integer types in  and 
> - ``static inline`` functions
> - designated initializers
> - intermingled declarations
> - booleans

Welcome to the future!

Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com