|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
TypeError for int with read-only attributes?
Hullo, I've got some code that keeps putting out the following error:
PHP Code:
self.track.size is assigned as a string object, and is later copied to be an int object when I need it as an int. I can't see why it wouldn't be mutable, so why do I keep getting this error |
|
#2
|
|||
|
|||
|
Er, because you can't modify the size of an int. They are pretty much one size fits all
If you need to alter the behavior of something based on the type of the variable, use the type() function to do type-checking first and then act accordingly. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > TypeError for int with read-only attributes? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|