473,465 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Writing a read only attribute

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
Jul 6 '07 #1
1 2850
On Jul 6, 8:27 am, Fabrizio Pollastri <pollas...@iriti.cnr.itwrote:
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:
>>'astring'.upper = 2
---------------------------------------------------------------------------
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

Jul 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Winter | last post by:
Below is the IDL definition of the HTMLOptionElement. interface HTMLOptionElement : HTMLElement { readonly attribute HTMLFormElement form; attribute boolean defaultSelected;...
0
by: Chris Birmele | last post by:
I am having difficulties maintaining table relationships when writing XML files, despite having set the relations property NESTED to TRUE. I assume therefore that something is wrong with my code. ...
5
by: Phil Kelly | last post by:
Hi I need to write the contents of a structure to a binary file - there is one string and 2 integers, but I can't seem to figure out how to write the data correctly. If I am simply writing...
2
by: Robert Reijntjes | last post by:
Hi, I need to read/write data from/to binary files that have an already defined. This means I can't define classes with the attribute. The files also have arrays with variable length. This...
6
by: Mizipzor | last post by:
Hi, this is my first mail to the list (and any list for that matter) so any pointers on errors from my part would be appreciated. Im more used to forums. To start off, Ive read some python...
2
by: Fabrizio Pollastri | last post by:
My code is the following: from Tkinter import * def tk_dummy_call(*args): return root = Tk() # save call address
118
by: Chuck Cheeze | last post by:
This might be in the wrong group, but... Here is an example of my data: entry_id cat_id 1 20 2 25 3 30 4 25 5 35
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.