•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,530 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,846 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 462 | Replies: 4
![]() |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
HI!
I have a problem:
I want to initalize a class by a condition.
For example:
How do I break the initalization?
Thank u and sorry for my english!
I have a problem:
I want to initalize a class by a condition.
For example:
class something:
def __init__(self,a):
self.a = a
if self.a == 0:
#break initalization
else:
#continue initalizationHow do I break the initalization?
Thank u and sorry for my english!
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
How do you mean?
If i use this:
The class initalized in the same way.
If i use this:
class A:
def __init__(self):
return None
a = A()
Last edited by Yee : Oct 8th, 2007 at 3:51 pm.
•
•
Join Date: Jul 2006
Posts: 562
Reputation:
Rep Power: 4
Solved Threads: 72
no, in the conditional:
Python Syntax (Toggle Plain Text)
class something: def __init__(self,a): self.a = a if self.a == 0: return else: #continue initalization
![]() |
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Implementing a C++ class for a ring buffer (C++)
- Loops (C++)
- Using C++ OOP class..... (C++)
- Can we Programaticall Write code in VB6.0, forms/standard module/class code window (Visual Basic 4 / 5 / 6)
- Some Help with a simple C++ class. (C++)
- Printing to Screen in a Class (C++)
- How do you output to the screen? (Java)
- first math class in uni (Geeks' Lounge)
Other Threads in the Python Forum
- Previous Thread: noob in need of guidance for calendar (days of month)
- Next Thread: Working with lists


Linear Mode