Hi all,

Are multiple conditionals at once okay in Python??

So for example:

if self.combobox.GetValue()!="" [B]and [/B]self.FilePathTextBox.GetValue()!="":

   [I][functions and objects go here]
   [functions and objects go here][/I]

else:
      self.SetStatusText('error')

Mainly a question on style ...
I tried it on my program, and the program seems to work fine.
Is this standard procedure or is there a better way to do things?
Does this normally happen in other languages like Java and C++/C#??

Thanks.

Yes, that is the way it's done in most languages.

You should get away with this ...

if self.combobox.GetValue() and self.FilePathTextBox.GetValue():

Test it with something simple like this ...

a = "m"
b = "n"
if a and b:
    print('okay')
else:
    print('error')

print('-'*20)

a = ""
b = "n"
if a and b:
    print('okay')
else:
    print('error')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.