"bob gailer" wrote
No, init() is only for initialising the object instance.
If you have no local instance spwecific initialisation
you can leave it to the inherited init() aor have no init()
at all.
Well I'd like to expand that a bit. There are cases where I create a
class attribute and upd
Thank you Steven, Modulok and Alan for your precious and detailed
explanations!
I understood that I must not overuse try-except statement and usually
when the exception could happen exceptionally.
By the way I have this piece of code using elementTree standard module
and according to Alan th
"ANKUR AGGARWAL" wrote
from Tkinter import *
root=Tk()
var=StringVar()
c=Checkbutton(root,text="hello",variable=var,onvalue="",offvalue="")
c.pack()
root.mainloop()
FWIW I get a different problem, namely that the var does not seem
to get updated nor does changling the var seem to alt
By the way I have this piece of code using elementTree standard module
>and according to Alan this is bad code I guess:
>
>
Which just proves there are no absolute rules in programming :-)
try: devdb.setDescription(dev.attrib['description'])
>except KeyError: pass
>try: devdb.setSymbolName
Thanks Alan this reassures me!
Regards
Karim
On 01/10/2011 10:39 AM, ALAN GAULD wrote:
By the way I have this piece of code using elementTree standard
module
and according to Alan this is bad code I guess:
Which just proves there are no absolute rules in programming :-)
*try
Karim wrote:
Thank you Steven, Modulok and Alan for your precious and detailed
explanations!
I understood that I must not overuse try-except statement and usually
when the exception could happen exceptionally.
By the way I have this piece of code using elementTree standard module
and accord
Steven many thanks for this useful hint!
I will modify my code.
Many thanks!
Regards
Karim
On 01/10/2011 11:32 AM, Steven D'Aprano wrote:
Karim wrote:
Thank you Steven, Modulok and Alan for your precious and detailed
explanations!
I understood that I must not overuse try-except statement
Alan Gauld wrote:
However, using exceptions like if/else blocks is bad practice.
I'm afraid I disagree strongly with that!
You need to use them like a commit in SQL - to protect a whole
block of code. Putting try/except around every line of code
defeats the purpose, wrap atomic blocks of cod
ANKUR AGGARWAL wrote:
> and i got the output as -
> [image: Screenshot.png]
The image doesn't survive.
> When i take the var as of string variable type i am unable to edit the
> checkbox. It comes slected predefined and the widget in kindof Invisible
> and
> u can say uneditable. Can anybody t
Alan Gauld wrote:
>
> "ANKUR AGGARWAL" wrote
>
>> from Tkinter import *
>> root=Tk()
>> var=StringVar()
>>
c=Checkbutton(root,text="hello",variable=var,onvalue="",offvalue="")
>> c.pack()
>> root.mainloop()
>
> FWIW I get a different problem, namely that the var does not seem
> to get
ANKUR AGGARWAL wrote:
> Hey I write this code up
>
> from Tkinter import *
> root=Tk()
> var=StringVar()
>
c=Checkbutton(root,text="hello",variable=var,onvalue="",offvalue="")
> c.pack()
> root.mainloop()
>
> and i got the output as -
> [image: Screenshot.png]
>
> When i take the var a
Hi Friends,
I'm Arun Kumar from India, Just a month ago i started learning
programming .learned some basics of python. I'm really enjoying
programming in python.
I have some doubts in python. When we write programs,we write some
import statements at the beginning of the code. how to know that we
On 1/10/2011 7:58 AM, arun kumar wrote:
Hi Friends,
I'm Arun Kumar from India, Just a month ago i started learning
programming .learned some basics of python. I'm really enjoying
programming in python.
I have some doubts in python. When we write programs,we write some
import statements at the b
On Jan 10, 2011, at 7:58 AM, arun kumar wrote:
> how to know that we
> should import something. How do we know that certain classes are in
> particular module?
You know to import a module if you need part of that module. Perhaps you need a
class or function defined in the module.
There are seve
Hello All,
I am not a beginner in Python language but I discovered a hidden
property of immutable elements as Numbers and Strings.
s ='xyz'
>>> t = str('xyz')
>>> id(s) == id(t)
True
Thus if I create 2 different instances of string if the string is
identical (numerically).
I get the same o
On 1/10/2011 8:07 AM Karim said...
Hello All,
I am not a beginner in Python language but I discovered a hidden
property of immutable elements as Numbers and Strings.
s ='xyz'
>>> t = str('xyz')
>>> id(s) == id(t)
True
Thus if I create 2 different instances of string if the string is
identi
On 1/10/2011 11:07 AM, Karim wrote:
Hello All,
I am not a beginner in Python language but I discovered a hidden
property of immutable elements as Numbers and Strings.
s ='xyz'
>>> t = str('xyz')
>>> id(s) == id(t)
True
Thus if I create 2 different instances of string if the string is
iden
On 1/10/2011 4:58 AM arun kumar said...
Hi Friends,
I'm Arun Kumar from India, Just a month ago i started learning
programming .learned some basics of python. I'm really enjoying
programming in python.
I have some doubts in python. When we write programs,we write some
import statements at the b
On 1/10/2011 11:51 AM, Emile van Sebille wrote:
well, not predictably unless you understand the specifics of the
implementation you're running under.
>>> from string import letters
>>> longstring = letters*100
>>> otherstring = letters*100
>>> id(longstring)
12491608
>>> id (otherstring)
121
On Mon, Jan 10, 2011 at 8:54 AM, bob gailer wrote:
> On 1/10/2011 11:07 AM, Karim wrote:
>
>>
>> s ='xyz'
>> >>> t = str('xyz')
>>
>> >>> id(s) == id(t)
>> True
>>
>> Thus if I create 2 different instances of string if the string is
>> identical (numerically).
>>
>
> Python "interns" certain lite
On 1/10/2011 9:23 AM bob gailer said...
On 1/10/2011 11:51 AM, Emile van Sebille wrote:
well, not predictably unless you understand the specifics of the
implementation you're running under.
>>> from string import letters
>>> longstring = letters*100
>>> otherstring = letters*100
>>> id(longst
Emile van Sebille, 10.01.2011 18:42:
On 1/10/2011 9:23 AM bob gailer said...
On 1/10/2011 11:51 AM, Emile van Sebille wrote:
well, not predictably unless you understand the specifics of the
implementation you're running under.
>>> from string import letters
>>> longstring = letters*100
>>> o
Karim, 10.01.2011 17:07:
I am not a beginner in Python language but I discovered a hidden property
of immutable elements as Numbers and Strings.
s ='xyz'
>>> t = str('xyz')
>>> id(s) == id(t)
True
Thus if I create 2 different instances of string if the string is
identical (numerically). I ge
"Steven D'Aprano" wrote
Wrapping an atomic block of code, so long as it actually *can* be
treated as atomic (including backing out any changes if it fails),
is a good use of try...except.
That's exactly what I meant by atomic. A (smallish) group of
instructions
that must be treated as a gro
"Peter Otten" <__pete...@web.de> wrote
I can select/deselect it with the mouse. its just the change to the
variable that is broken.
This was the problem using the Stringvar.
Then var changes OK. Here is my code(from Pythonwin):
def f(): global var; var = 'on' if var == 'off' else 'off';
"arun kumar" wrote
I have some doubts in python. When we write programs,we write some
import statements at the beginning of the code. how to know that we
should import something.
Trial and error, experience and mainly reading the documentation.
You try to do something and there is no obvious
Many thanks Emile, Bob, Stefan, Wesley!
Now, I see now that the point is more related to implementation details
and optimization instead of a true
property. But it could mistaken people not aware.
Regards
Karim
On 01/10/2011 06:56 PM, Stefan Behnel wrote:
Karim, 10.01.2011 17:07:
I am not
On 01/09/2011 04:27 PM, Steven D'Aprano wrote:
> Corey Richardson wrote:
>> Do all classes need an __init__() method? I have classes that look much
>> like this one starts out:
>>
>> class GenerateXML(object):
>> """Defines methods to be inherited for StaticXML and AnimationXML"""
>> def __
Hello,
Does anyone have a program that will read txt file data and insert -
or similar for missing data? I have 10minute data and there are hour
chunks that are missing that need a missing data insert for that missing
hour but not the 10min period. The txt file has a date column (yymmdd),
a
On 1/10/2011 4:10 PM Benson, Randall said...
Hello,
Does anyone have a program that will read txt file data and insert -
or similar for missing data? I have 10minute data and there are hour
chunks that are missing that need a missing data insert for that missing
hour but not the 10min perio
"Benson, Randall" wrote
hour but not the 10min period. The txt file has a date column
(yymmdd),
a time (hhmm) column and the rest are data columns shown below. See
column 1 below with i
Not sure what the last sentence merans? Was there supposed to
be more? Or what is the 'i' referred to?
On 1/10/2011 7:10 PM, Benson, Randall wrote:
Hello,
Does anyone have a program that will read txt file data and insert -
or similar for missing data? I have 10minute data and there are hour
chunks that are missing that need a missing data insert for that missing
hour but not the 10min perio
32 matches
Mail list logo