¡@

Home 

python Programming Glossary: self.s

How is the 'is' keyword implemented in Python?

http://stackoverflow.com/questions/2987958/how-is-the-is-keyword-implemented-in-python

they didn't work. class MyString ... def __init__ self ... self.s 'string' ... def __is__ self s ... return self.s s ... m MyString.. self ... self.s 'string' ... def __is__ self s ... return self.s s ... m MyString m is 'ss' False m is 'string' # Expected to.. to work False class MyString ... def __init__ self ... self.s 'string' ... def __eq__ self s ... return self.s s ... m MyString..

Is this use of isinstance pythonic/“good”?

http://stackoverflow.com/questions/3111611/is-this-use-of-isinstance-pythonic-good

object def __init__ self h 0 m 0 s 0 self.h 0 self.m 0 self.s 0 def __iadd__ self other if isinstance other MyTime self.h.. if isinstance other MyTime self.h other.h self.m other.m self.s other.s elif isinstance other int self.h other 3600 other 3600.. int self.h other 3600 other 3600 self.m other 60 other 60 self.s other else raise TypeError 'Addition not supported for ' type..

Python SocketServer: sending to multiple clients?

http://stackoverflow.com/questions/3670127/python-socketserver-sending-to-multiple-clients

class Host def __init__ self self.address 'localhost' 0 self.server SocketServer.TCPServer self.address EchoRequestHandler.. self.address EchoRequestHandler ip port self.server.server_address self.t threading.Thread target self.server.serve_forever.. self.server.server_address self.t threading.Thread target self.server.serve_forever self.t.setDaemon True self.t.start print..

Lazy logger message string evaluation

http://stackoverflow.com/questions/4148790/lazy-logger-message-string-evaluation

a lazyjoin class. class lazyjoin def __init__ self s items self.s s self.items items def __str__ self return self.s.join self.items.. s items self.s s self.items items def __str__ self return self.s.join self.items Use it like this note the use of a generator..

Python Pyramid & Chameleon templating language escapes html

http://stackoverflow.com/questions/5346295/python-pyramid-chameleon-templating-language-escapes-html

pt PageTemplate a class Literal object def __init__ self s self.s s def __html__ self return self.s print pt t Literal ' p Hi..