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