[IronPython] private functions within a module
Michael Foord
fuzzyman at voidspace.org.uk
Thu Jun 18 22:38:29 CEST 2009
Justin Regele wrote:
> As of Python25, there is no thing as a 'private' method, although the
> _method() convention is what is generally used.
>
> also, staticmethod(objfunc) is used to make a method static. don't
> know if yo already know this. rather an annoying way of doing it.
class Static(object):
@staticmethod
def method():
print 'this is a static method'
Static.staticmethod()
Not that you need them in Python - functions or class methods
(@classmethod) are almost always better.
Michael
>
> On Mon, Jun 15, 2009 at 11:34 AM, Michael Foord
> <fuzzyman at voidspace.org.uk <mailto:fuzzyman at voidspace.org.uk>> wrote:
>
> Elise Langham (Elanit) wrote:
>
>
> How can i define some functions within a module as private ?
>
> Do i need to make them part of a static class ? or is this
> this not possible?
>
>
> The convention is to start their names with an underscore. That
> will tell other developers not to call them directly.
>
> Michael
>
> Thanks,
>
>
> Elise
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
More information about the Ironpython-users
mailing list