DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
create instances of a class in a for loop
objs = [MyClass() for i in range(10)] for obj in objs: other_object.add(obj) objs[0].do_sth()
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#create
#instances
#class
#loop
ADD COMMENT
Topic
COMMENT
Name
3+7 =
Submit