[Python-3000] Generic function PEP won't make it in time

Luis P Caamano lcaamano at gmail.com
Tue Apr 24 20:56:21 CEST 2007


On 4/24/07, "Guido van Rossum" <guido at python.org> wrote:
>
>
>
> But Python doesn't have protected, and isn't about to get it.
>

We use methods names with one underscore as a convention for protected
methods and I think we learned that from somebody else:

class Eggs:

  def thePublicMethod(self):
      things = self._myProtected()
      return [ "thing_%s" % str(thing) for thing in things]

  def _myProtected(self):
      raise RuntimeError("missing base method")

class RealEggs(AbstractEggs):
  def _myProtected(self):
      return ["one", "two"]


-- 
Luis P Caamano
Atlanta, GA USA


More information about the Python-3000 mailing list