Програмиране с Python » Форуми » Общи въпроси

Въпрос относно наследяването

(2 posts)
  • Started 6 years ago by Tokay-Ihto
  • Latest reply from wireman

  1. Tokay-Ihto
    Member

    Posted 6 years ago #
  2. :D Мисля, че нещо такова може и да сработи:

    class A:
        def specialFunction(self, argument):
            if isinstance(argument, A) and \
               argument.__class__.__bases__ == A.__bases__:
                pass #argument is a direct instance of A
    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.