Writing a read only attribute

  • Thread starter Fabrizio Pollastri
  • Start date
F

Fabrizio Pollastri

Hello,
it is possible to force in some way a write to a read-only attribute of
a python object? In which case?
Thanks for any answer.

F. Pollastri
 
M

Michele Simionato

Hello,
it is possible to force in some way a write to a read-only attribute of
a python object? In which case?
Thanks for any answer.

F. Pollastri

What do you mean by read-only attribute?
If you are trying to change attributes of built-in objects, there is
no hope:
---------------------------------------------------------------------------
exceptions.AttributeError

AttributeError: 'str' object attribute 'upper' is read-only

If the read-only attribute has been implemented via a property, there
is a way
to write it, but you should tell us more about your case.

Michele Simionato
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top