tuple not recognized as a type ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

tuple not recognized as a type ?

Grégoire Dooms-3
Hello,

I have been trying to use tuple as a generic type argument:
In [4]: from System.Collections.Generic import List
In [5]:
In [6]: x = List[int](range(4))
In [7]: x = List[tuple]([() for t in range(4)])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

h:\python\testPyNet.py in <module>()
----> 1
      2
      3
      4
      5

TypeError: type(s) expected

I had a similar problem in a generic method of a non-generic class.

I have two questions:
* Is there a work around ?
* How do you debug python for .NET ?
  I tried to attach a Visual Studio 2005 debugger to the python process and break in ClassObject.type_subscript but VS does not load the symbols.

Thanks for this project, I would love to use it.
--
Greg






_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet
Reply | Threaded
Open this post in threaded view
|

Re: tuple not recognized as a type ?

Tribble, Brett

If  you have your .net assembly put up a modal dialog (messagebox), you can attach to the process from DevStudio, set breakpoints, etc.

 

From: pythondotnet-bounces+btribble=[hidden email] [mailto:pythondotnet-bounces+btribble=[hidden email]] On Behalf Of Grégoire Dooms
Sent: Friday, May 01, 2009 8:50 AM
To: [hidden email]
Subject: [Python.NET] tuple not recognized as a type ?

 

Hello,

 

I have been trying to use tuple as a generic type argument:

In [4]: from System.Collections.Generic import List

In [5]:

In [6]: x = List[int](range(4))

In [7]: x = List[tuple]([() for t in range(4)])

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

 

h:\python\testPyNet.py in <module>()

----> 1

      2

      3

      4

      5

 

TypeError: type(s) expected

 

I had a similar problem in a generic method of a non-generic class.

 

I have two questions:

* Is there a work around ?

* How do you debug python for .NET ?

  I tried to attach a Visual Studio 2005 debugger to the python process and break in ClassObject.type_subscript but VS does not load the symbols.

 

Thanks for this project, I would love to use it.

--

Greg

 

 

 

 

 


_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet
Reply | Threaded
Open this post in threaded view
|

Re: tuple not recognized as a type ?

Brian Lloyd-7
Re: [Python.NET] tuple not recognized as a type ? Hi Brett – Generics only work with CLR types and primitive Python types that have
a direct CLR equivalent (string, int, etc.), so you really can’t do this with tuples. Not
sure what you were going for in the example, but generally you will want to use
CLR collection types when interacting with CLR objects and apis.

For debugging your best bet would be vstudio for looking at the integration layer,
but YMMV given all the transitions between managed code, native code, generated
code, etc.

hope this helps,

-Brian

On 5/1/09 1:29 PM, "Tribble, Brett" <[hidden email]> wrote:

If  you have your .net assembly put up a modal dialog (messagebox), you can attach to the process from DevStudio, set breakpoints, etc.
 

From: pythondotnet-bounces+btribble=[hidden email] [[hidden email] On Behalf Of Grégoire Dooms
Sent: Friday, May 01, 2009 8:50 AM
To: [hidden email]
Subject: [Python.NET] tuple not recognized as a type ?

Hello,

 

I have been trying to use tuple as a generic type argument:

In [4]: from System.Collections.Generic import List

In [5]:

In [6]: x = List[int](range(4))

In [7]: x = List[tuple]([() for t in range(4)])

---------------------------------------------------------------------------

TypeError                                Traceback (most recent call last)

 

h:\python\testPyNet.py in <module>()

----> 1

      2

      3

      4

      5

 

TypeError: type(s) expected

 

I had a similar problem in a generic method of a non-generic class.

 

I have two questions:

* Is there a work around ?

* How do you debug python for .NET ?

  I tried to attach a Visual Studio 2005 debugger to the python process and break in ClassObject.type_subscript but VS does not load the symbols.

 

Thanks for this project, I would love to use it.

--

Greg

 

 

 

 

 


_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet


--------------------------
Brian Lloyd   540.845.2975

[hidden email]

_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet