Thanks for clarifying. I generally think of compatibility making it so
whatever you do in Py3 you can do in Py2. In this case the common idiom is
to reference a builtin from its module (builtins.foo) rather than to try
import foo from builtins (which works with Py3 but not with Py2 *with the
In Python 2 builtins was called called __builtin__. That's why it's in
the compatibility module (not to be confused with __builtins__, which
is a different thing, hence the rename). You could just as well write
try:
# Python 3
from builtins import type
except ImportError:
# Python 2
Hmm - yes, that works for me, too. But in Py3 you can do 'from builtins
import type' -- is the only way to do that in 2 is to use monkey patching?
/c
On Thursday, May 9, 2019 at 2:36:21 PM UTC-5, Aaron Meurer wrote:
>
> This works for me:
>
> Python 2.7.14 | packaged by conda-forge | (default,
This works for me:
Python 2.7.14 | packaged by conda-forge | (default, Dec 9 2017, 16:31:12)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy.core.compatibility import builtins
>>>
builtins is in core.compatibility and it doesn't seem to work for me.
The issue will go away when we drop Py 2.7...or sooner if someone can
figure out what's wrong.
On Wednesday, May 8, 2019 at 5:02:05 PM UTC-5, Aaron Meurer wrote:
>
> On Wed, May 8, 2019 at 3:48 PM Oscar Benjamin
> > wrote:
On Wed, May 8, 2019 at 3:48 PM Oscar Benjamin
wrote:
>
> On Wed, 8 May 2019 at 22:38, Chris Smith wrote:
> >
> > None of them work
>
> That's what I get for not trying them out!
>
> > >>> import sympy.core.compatibility.builtins as builtins
> > Traceback (most recent call last):
> > File "",
On Wed, 8 May 2019 at 22:38, Chris Smith wrote:
>
> None of them work
That's what I get for not trying them out!
> >>> import sympy.core.compatibility.builtins as builtins
> Traceback (most recent call last):
> File "", line 1, in
> ImportError: No module named builtins
>
> >>> from
for
> Windows 10
>
>
>
> *From: *Chris Smith
> *Sent: *09 May 2019 03:08
> *To: *sympy
> *Subject: *Re: [sympy] is compatibility builtins broken?
>
>
>
> None of them work
>
>
>
> >>> import sympy.core.compatibility.builtins as builtins
&g
What do these builtins ought to be doing?
Sent from Mail for Windows 10
From: Chris Smith
Sent: 09 May 2019 03:08
To: sympy
Subject: Re: [sympy] is compatibility builtins broken?
None of them work
>>> import sympy.core.compatibility.builtins as builtins
Traceback (most recent
None of them work
>>> import sympy.core.compatibility.builtins as builtins
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named builtins
>>> from sympy.core.compatibility.builtins import type
Traceback (most recent call last):
File "", line 1, in
ImportError:
On Wed, 8 May 2019 at 08:23, Chris Smith wrote:
>
> Am I doing something wrong here when running Python 2?
>
> >>> from sympy.core.compatibility import builtins
> >>> from builtins import type
> Traceback (most recent call last):
> File "", line 1, in
> ImportError: No module named builtins
Hi Chris,
I am using version 1.5-dev
> In [2]: from sympy.core.compatibility import builtins
> In [3]: from builtins import type
> In [4]:
Also,
> >>> from sympy.core.compatibility import builtins
> >>> from builtins import type
> >>>
On Wed, May 8, 2019 at 12:53 PM Chris Smith wrote:
>
Am I doing something wrong here when running Python 2?
>>> from sympy.core.compatibility import builtins
>>> from builtins import type
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named builtins
/c
--
You received this message because you are subscribed to
13 matches
Mail list logo