python dynamically typed: Yes
C# dynamically typed: No, strongly typed. It uses lots of overloads to
return the required type.
I suppose some embedder somewhere has a neat way of applying the type
info on the PyObject to some sort of wrapper.
What language is that, anyway? It looks sort of interesting.
Barton
On 01/28/2013 08:05 AM, Pierre-Yves Strub wrote:
Hi,
While playing with the .NET python runtime (see code bellow), I have
been surprised to see that the dynamic type of all values returned by
the runtime is PyObject. For instance, in the latter example, I would
expect "sum" to be of dynamic type PyInt and to be able to write (sum
:?> PyInt) instead of (PyInt.AsInt sum). Is it a "feature" of the
runtime binding ?
let entry () =
PythonEngine.Initialize ()
use lock = new PythonEngineLock () in
use builtin = PythonEngine.ImportModule ("__builtin__") in
use data =
new PyList
(data |> Array.map (fun i -> new PyInt (i) :> PyObject)) in
use sum = builtin.GetAttr("sum").Invoke([|data :> PyObject|]) in
printfn "%A" (sum.GetType ());
printfn "%A" (sum.GetPythonType ())
Best,
Pierre-Yves.
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet