Level 10 : What is the output for the below code?


class D:
    def __get__(self, obj, objtype):
        return "desc"

class C:
    x = D()

c = C()
c.__dict__['x'] = "instance"

print(c.x)

Author: VenuEmmela | Tags: classes | 1859+ Python FAQs | Share
context-manager | directory-operations | async | call | string-method | matplotlib | multiple-except-blocks | mysql | logical-operator | list-vs-tuple | benefit | command-line-parsing | method-overloading | else-statement | parameter | basic | mutable | center | identifier | namespace | nested-loop | identity-operators-(is,-is-not) | operations | classes | reading-and-writing-files | data-type | floating-point-precision | loops | magic-method | goto-function | random-function | built-in-function | pseudocode | python-module | math-copysign | strings | regular-expression | formal-and-actual-parameter | multiprocessing | raise-statement | encapsulation | regex | loop-control | error | implementation | return-statement | name-mangling | string | design-principle | split | slicing | collections | package-management | min-function | logical-operators | test-discovery | list-slicing | sets | list-comprehensions | conditional-statements | multithreading | list,-set,-and-dictionary-comprehensions | namedtuple | opening-files-(open()) | __all__-attribute | binary-operation | inheritance | python-repl | creating-custom-modules | precedence-and-associativity | exception | list-indexing | advanced-file-operations | math | function | indentation | static-method | class-and-inheritance | class-decorators | lambda-function | software-design | precedence | immutable-data-type | regular-expressions | head-and-tail | loop-control-statements | immutability | functions | filtering-and-indexing | assignment-operators | bitwise-operator | file_handling | sys | filter-function | lambda | version | using-yield-in-functions | installation | round | python-django | file-handling | control-statement | writing:-write(),-writelines() | working-with-temporary-files-using-tempfile | input-function | typeerror | string-concatenation | syntaxerror | debugging | condition | multiple-inheritance | iterators | recurssion | booleans | sys-module | threading | default-arguments | pandas | asyncio | set | methods | list | input | string-slicing | invalid-list | while-loop | arithmetic-operation | data-type | list-join | expression | bitwise-operator | recursion | iterator | data_structure | stack | global-keyword | functional-programming | identity-operator | access-modifier | python-operators | single-inheritance | boolean-and-non-boolean | bitwise | staticmethod | class-and-instance-variable | statement | binary | slice | generators | handling-missing-values-(fillna,-dropna) | interpreter | application | swapping | while-else-loop | comprehension | parsing-with-strptime | conditional-statement | dataframe-and-series-objects | postfix | floats | keyword | using-map()-for-transformations | matrix | key-value-pairs | asyncio-module | arbitrary-arguments-(*args,-**kwargs) | thread | operator-and | error-handling | why-use-multiprocessing-over-threading?-(gil) | docstring | join | string-manipulation | list-mutation | boolean | sum() | logical-operation | dictionary-comprehensions | built-in-modules | syntax-error | rollback | working-with-file-paths | init | pep | dictionary-methods | set-operation | round-function | global-variable | file-handling | tuple-methods | generators-in-python | sum-function | using-else-and-finally | logical-operator | type-conversion | id-function | overflow | operator-or | functional-programming | descriptors | numeric | sorting-and-ranking | list-operation | list-methods-and-slicing | data-types | string-slicing | dictionaries | variable | string-formatting | __init_subclass__ | membership-operators-(in,-not-in) | destructor | assert | boolean-masking | enumerate() | global | operator | lambda-functions | global-variable | tuple-unpacking | method | function-argument | heap-memory | type-conversion-and-casting | built-in-function | match | iterable | thread-synchronization | odd-number | data-type-conversions | filter | control-flow | compute | array | update | class-and-object | max-min | datetime | turtle | managing-directories-with-os-and-shutil | counter | python_version | factorial-function | python-syntax-and-structure | operand | string-methods | string-iteration | higher-order-function | range | reading-and-writing-large-files-efficiently | map-function | complex | __future__ | matrix-list-comprehension | format | reading:-read(),-readline(),-readlines() | memory | library | random | inherit | identity-operator | conditional-statement | function-and-scope | difference-between-threads-and-processes | attribute | numpy | else | decorator | formatting-with-strftime | introduction-to-threads | mathematical-function | built-in | integers | loop | scientific-notation | syntax-error | yield | gil | polymorphism | min-max-function | datetime.date,-datetime.time,-datetime.datetime | complex-number | oop | print-statement | unit-testing | pass | version-check | comparison | sorted | integer | literal-characters-and-special-characters | input-function | data-structures | multiple-inheritance | for | fabs-function | list-method | error-handling | while-loops | sorting | import-method | conversion | intering | deep-copy | assignment-operator | shallow-copy | introduction-to-multiprocessing | mapping-function | virtual-environment | escape-operator | defining-functions | while-and-for-loop | lists | memory-management | comment | constructor | string-method | syntax | data-structures-in-python | aggregating-data-with-functools.reduce() | indexing:-loc-vs-iloc | encoding | indexing | with-statement | feature | oops | tuple | type-conversion | dicts | walking-through-directories-using-os.walk() | expand-tab | zfill-function | exponentiation | int | time-series-with-pandas | thread-safe-data-structures-(queue.queue) | zip-function | operator-overloading | control-flow | pickling--unpickling | working-with-dates-and-times | operators | lambdas | tuples | using-assertions-(assertequal,-assertraises) | overriding-methods | list-comprehension | module | append | collection | class | using-join()-and-is_alive()-methods | creating-and-starting-threads | introduction-to-python | object-attribute | data-structure | arithmetic-expression | joining-and-merging-dataframes | virtual-environment | anchors-(^,-$) | using-os-and-pathlib-modules | datatype | zip | quantifiers-(*,-+,-?,-{}) | exception-handling | working-with-binary-files-(rb,-wb) | copy | print | type_conversion | choice | objects | exception-handling | list-comprehension | dictionary | file | default-mutable-argument | generator | using-the-threading-module | python-history | decimal | def | using-lists-as-stacks | python | data-structure | counter-function | string-formatting | frozenset | raise | touples | mathematics ...