[Python.NET] Passing in null as the value for a nullable type.

John Gill jgill at tokiomillennium.com
Wed Feb 5 19:25:17 CET 2014


Thanks.   At least on my system there is no such thing as System.Null

In c# at least, null is just a keyword in the language.


From: PythonDotNet [mailto:pythondotnet-bounces+jgill=tokiomillennium.com at python.org] On Behalf Of Tribble, Brett
Sent: Wednesday, February 05, 2014 1:45 PM
To: A list for users and developers of Python for .NET
Subject: Re: [Python.NET] Passing in null as the value for a nullable type.

I believe you want to import System and pass System.Null. I can't remember if I've done this, but I think so.

From: PythonDotNet [mailto:pythondotnet-bounces+btribble=ea.com at python.org] On Behalf Of John Gill
Sent: Wednesday, February 05, 2014 8:47 AM
To: pythondotnet at python.org
Subject: [Python.NET] Passing in null as the value for a nullable type.

I am sure there is a really simple answer to this one... but so far it is eluding me.

I have a class something like this:

public class Foo
{
  ...
    public int process_date(DateTime? mydate)
   {
      ...
   }
}


I want to call this from python using pythondotnet.


Calling it like this works fine:

     mydate = DateTime(0)
     Foo().process_date(mydate)

But if I try to pass in a null as the date as follows:

    Foo().process_date(None)

I get:

   TypeError: No method matches given arguments

Hoping there is something really obvious I am missing here.

John
This communication and any attachments contain information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying, printing or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please return it with the title "received in error" to postmaster at tokiomillennium.com<mailto:postmaster at tokiomillennium.com> and then permanently delete the email and any attachments from your system.


E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses. It is the recipient's responsibility to ensure that e-mail transmissions and any attachments are virus free. We do not accept liability for any damages or other consequences caused by information that is intercepted, corrupted, amended, lost, destroyed, arrives late or incomplete or contains viruses.
******************************************

This communication and any attachments contain information which is confidential and may also be legally privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying, printing or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please return it with the title "received in error" to postmaster at tokiomillennium.com and then permanently delete the email and any attachments from your system.

E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses. It is the recipient's responsibility to ensure that e-mail transmissions and any attachments are virus free. We do not accept liability for any damages or other consequences caused by information that is intercepted, corrupted, amended, lost, destroyed, arrives late or incomplete or contains viruses.
******************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20140205/e1860a3a/attachment-0001.html>


More information about the PythonDotNet mailing list