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