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