Re: Defining constant strings

2006-08-27 Thread danielx
I would really like to highlight something Tal has already said: Python strings are immutable. That means if you construct a string object, you don't have to worry about someone else going in and changing that object. What might happen, however, is that someone might reassign a variable you have wh

Re: Defining constant strings

2006-08-27 Thread Peter Otten
Hans wrote: > I want to define a couple of constant strings, like in C: > #define mystring "This is my string" > or using a const char construction. > > Is this really not possible in Python? No, this is not really not possible in Python: $ ls preprocess.pyp $ cat preprocess.pyp #define MYSTRIN

Re: Defining constant strings

2006-08-27 Thread Tal Einat
Hans wrote: > Hi, > > I want to define a couple of constant strings, like in C: > #define mystring "This is my string" > or using a const char construction. > > Is this really not possible in Python? > > Hans One last note: If you truly insist on having constant variables, you could write a class

Re: Defining constant strings

2006-08-27 Thread Tal Einat
Hans wrote: > Hi, > > I want to define a couple of constant strings, like in C: > #define mystring "This is my string" > or using a const char construction. > > Is this really not possible in Python? > > Hans It is really not possible. The Pythonic way (as far as I have come to know it) is to st

Defining constant strings

2006-08-27 Thread Hans
Hi,   I want to define a couple of constant strings, like in C: #define mystring "This is my string" or using a const char construction.   Is this really not possible in Python?   Hans -- http://mail.python.org/mailman/listinfo/python-list