[Ironpython-users] How can IronPython access a public static value defined in C#?

Doug Blank doug.blank at gmail.com
Mon Jun 20 14:16:23 CEST 2011


On Mon, Jun 20, 2011 at 2:40 AM, Markus Schaber
<m.schaber at 3s-software.com> wrote:
> Hi, Doug,
>
>> Von: Doug Blank
>
> [> ]
>> On Sun, Jun 19, 2011 at 3:06 AM, Abubakar <abubakarm at gmail.com> wrote:
>> > try reading the following, maybe that'll explain:
>> > http://stackoverflow.com/questions/44834/can-someone-explain-all-in-py
>> > thon
>> > ..ab
>>
>> Well, my question was about how to do that in C#.
>>
>> I can indeed do this:
>>
>> public static class Myro {
>>  public readonly static List __all__ = new List() {"robot"};  public
>> static Robot robot {
>>     get {}
>>     set {}
>>  }
>> }
>>
>> but then "robot" is the *only* item imported. I would like add robot to
>> the list of items imported.
>
> Just as in Python itsself, you cannot "add" values to __all__, you have to set the full list of all wanted members.

Yes, indeed. So, my question is: how to get a "public static property"
to be dynamically included with "from x import *"? You can't mark it
readonly, right? And it doesn't seem possible without enumerating the
static items myself and creating __all__. Perhaps a special DLR
method/setting could be added?

-Doug

> Mit freundlichen Grüßen
>
> Markus Schaber
>
> ___________________________
> We software Automation.
>
> 3S-Smart Software Solutions GmbH
> Markus Schaber | Entwicklung
> Memminger Str. 151 | 87439 Kempten | Tel. +49-831-54031-0 | Fax +49-831-54031-50
>
> Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com
> CoDeSys Internet-Forum: http://forum.3s-software.com
>
> Geschäftsführer: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Handelsregister: Kempten HRB 6186 | USt-IDNr.: DE 167014915
>


More information about the Ironpython-users mailing list