Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. class Ship(object):·                                                      
  2. ·                                                                        
  3.     def make_ship(type):·                                                
  4.         if type == "shuttle":·                                        
  5.             return Shuttle()·                                            
  6.         if type == "freighter":·                                                                                          
  7.             return Freighter()·                                                                                          
  8.         if type == "frigate":·                                                                                            
  9.             return Frigate()·                                                                                            
  10.         #assert 0, "No such ship class %s" % type·                                                                                                    
  11.         cemit("space", "Invalid type passed to Ship.make_ship().")·                                                                                  
  12.         return None·                                                                                                      
  13.         ·                                                                                                                
  14.     make_ship = staticmethod(make_ship)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement