[IronPython] Regression with Beta9?

Bruce Christensen t-bruch at microsoft.com
Fri Jul 14 20:24:52 CEST 2006


The CLR names are still available on __builtins__ (but strangely not on
__builtin__ when it is imported). As a somewhat ugly workaround, you can
copy the names from __builtins__ into your local namespace:

 

>>> import clr

>>> HasAttr

Traceback (most recent call last):

  File , line 0, in <stdin>##6

NameError: name 'HasAttr' not defined

>>> for attr in dir(__builtins__):

...         locals()[attr] = getattr(__builtins__, attr)

...

>>> 

>>> HasAttr

<built-in function HasAttr>

>>> 

 

You can also copy them into globals() if you want them available
everywhere.

 

--Bruce

 

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver
Sent: Friday, July 14, 2006 9:00 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Regression with Beta9?

 

What about the previous email?  I currently cannot access any IronPython
specific constructs which are in the __builtins__ module, or any other
module:

 

>>> import clr

>>> HasAttr

Traceback (most recent call last):

  File , line 0, in <stdin>##16

NameError: name 'HasAttr' not defined

>>> __builtins__.HasAttr

<built-in function HasAttr>

 

Other modules have similar problems, such as:

 

>>> import clr

>>> import thread

>>> thread.StartNewThread

Traceback (most recent call last):

  File , line 0, in <stdin>##19

AttributeError: 'module' object has no attribute 'StartNewThread'

 

Whereas StartNewThread was a .Net style alias for
thread.start_new_thread in IronPython 8.

 

Thanks,

-Lee

 

________________________________

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Martin Maly
Sent: Thursday, July 13, 2006 9:50 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Regression with Beta9?

 

Yep, we have entered the ToString issue, but your operator issue is a
new one. I've filed it in CodePlex as work item 939

 

Martin

 

________________________________

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver
Sent: Thursday, July 13, 2006 8:35 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Regression with Beta9?

 

And another one...

 

IronPython 1.0.60712 (Beta) on .NET 2.0.50727.42

Copyright (c) Microsoft Corporation. All rights reserved.

>>> import clr

>>> 

>>> clr.AddReferenceByPartialName("Microsoft.DirectX")

>>> from Microsoft import DirectX

>>> v = DirectX.Vector3(1, 2, 3)

>>> v * 2

...]>osoft.DirectX.Vector3 object at 0x000000000000002C [Z : 6

>>> v * 2.2

Traceback (most recent call last):

  File , line 0, in <stdin>##30

TypeError: unsupported operand type(s) for *: 'Vector3' and 'float'

 

Whereas this worked fine in IronPython8 (and indeed the DirectX.Vector3
class supports a multiplication with floats):

 

IronPython 1.0.2376 (Beta) on .NET 2.0.50727.42

Copyright (c) Microsoft Corporation. All rights reserved.

>>> import clr

>>> clr.AddReferenceByPartialName("Microsoft.DirectX")

>>> v = DirectX.Vector3(1, 2, 3)

Traceback (most recent call last):

  File , line 0, in <stdin>##13

NameError: name 'DirectX' not defined

>>> from Microsoft import DirectX

>>> v = DirectX.Vector3(1, 2, 3)

>>> v * 2

Z : 6

Y : 4

X : 2

 

>>> v * 2.2

Z : 6.6

Y : 4.4

X : 2.2

 

I think the ToString issue has already been reported...

 

Thanks

-Lee

 

________________________________

From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Lee Culver
Sent: Thursday, July 13, 2006 8:17 PM
To: Discussion of IronPython
Subject: [IronPython] Regression with Beta9?

 

This seems to not work anymore:

 

>>> import clr

>>> HasAttr

Traceback (most recent call last):

  File , line 0, in <stdin>##9

NameError: name 'HasAttr' not defined

 

Whereas under Beta8 it worked fine...  Is this intentional?  If so, this
seems a bit weird that it's still in __builtins__:

>>> __builtins__.HasAttr

<built-in function HasAttr>

 

Thanks

-Lee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060714/c6a6b7dd/attachment.html>


More information about the Ironpython-users mailing list