Re: How to extend an object?

2019-12-20 Thread DL Neil via Python-list
On 21/12/19 2:50 pm, Greg Ewing wrote: On 21/12/19 1:59 am, Stefan Ram wrote:    I would like to add a method to a string.    This is not possible in Python? It's not possible. Built-in classes can't have methods added to them. You can define your own subclass of str and give it whatever

Re: How to extend an object?

2019-12-20 Thread Greg Ewing
On 21/12/19 1:59 am, Stefan Ram wrote: I would like to add a method to a string. This is not possible in Python? It's not possible. Built-in classes can't have methods added to them. You can define your own subclass of str and give it whatever methods you want. But in your case: for