telnetlib in python-3.0
Is anyone using telnetlib in python-3.0? If so are you having any success? Using the example at the bottom of the telnetlib doc page I cannot seem to get any joy at all. I can make a connection, but write (command) seems to do nothing. Thanks, Rowland -- http://mail.python.org/mailman/listinfo/python-list
synthetic properties
I'm trying to come up with solution for adding synthetic properties to
python, similar to synthetic properties in Objective-C.
I'm playing around with doing this in a MetaClass. I can dynamically
create the attributes that will back the property, but I'm having
trouble figuring out how to dynamically generate get/set methods to
pass to the built-in property() function.
Is it possible to define a lambda or a callable object that will act
as a getter method (or setter, that takes a value argument) during
MetaClass.__init__? The hard part I'm guessing is getting the current
instance passed into the getter. This is my first foray into
MetaClasses and dynamic functions/methods so any pointers are greatly
appreciated.
class ObjectivePythonObject( type ) :
def __new__( cls, name, bases, dct ) :
#print "Allocating memory for class", name
return type.__new__(cls, name, bases, dct )
def __init__( cls, name, bases, dct ) :
#print "Initializing class", name
for propertyInfo in cls.synthesized :
property = propertyInfo[ 0 ]
defaultValue = propertyInfo[ 1 ]
print property
setattr( cls, '_' + property, defaultValue )
# Create property with get/set methods...
class Person( object ) :
__metaclass__ = ObjectivePythonObject
synthesized = [ ( 'name', 'BobC' ),
( 'age', '48' ) ]
def __init__( self ) :
print self._name
print self._age
Thanks,
Rowland
--
http://mail.python.org/mailman/listinfo/python-list
Simplest solution for formatting local time in iso 8601 including time zone.
What's the simplest solution for formatting the output of local time in iso 8601 including the time zone information? Example: "2008-07-25T14:28:43.934-04:00" Thanks, Rowland -- http://mail.python.org/mailman/listinfo/python-list
New Python book, "Learn Python Quickly"
Hi All, You may be interested in my latest book "Learn Python Quickly". It's a Kindle book but is specifically designed to be used with any of the free-to-download Kindle Reading Apps. What's special about the book is its comprehensive glossary and the numerous in-text internal hyperlinks to topics in the glossary, allowing the reader to quickly jump to glossary topics to clarify the terms used in the text. The book can be followed by those with zero prior knowledge of the language and very little general language experience, but leads the reader in easy stages to quite sophisticated coding skills including classes and Graphical User Interface (GUI) programming. There are numerous graded exercises, all with sample answers at the end of the book. There is also a companion web site from which those programs can be freely copied and used immediately in Python's IDLE interface. (This overcomes the copying restriction imposed on Kindle books.) The programs and lots of Information about the book (including sample chapters and an extract from the glossary) can be found on www.learnpythonquickly.com and the book itself is available from Amazon, from where you can download the reading apps and then download a further sample of the book onto those apps. I do hope you find this of interest. Kind regards, John Rowland -- http://mail.python.org/mailman/listinfo/python-list
"Learn Python Quickly" is FREE today March 18th
For just today, the book "Learn Python Quickly" is free to download from Amazon. Also, go to www.learnpythonquickly.com for more information. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Learn Python Quickly" is FREE today March 18th
On Monday, March 18, 2013 12:55:18 PM UTC, John Rowland wrote: > For just today, the book "Learn Python Quickly" is free to download from > Amazon. > > Also, go to www.learnpythonquickly.com for more information. To Terry Reedy. That's just the sort of constructive criticism I was hoping would be forthcoming. Thank you. I'll note this on the web site and include it in the first book update. JR -- http://mail.python.org/mailman/listinfo/python-list
chained exceptions
Is anyone aware of a module or recipe for defining a composite/chained exception superclass? I've seen the PEP on chained exceptions wrt Python-3K, but I'm looking for something that is 2.5 compatible. -Rowland --- "The Dude abides." - The Dude, The Big Lebowski --- -- http://mail.python.org/mailman/listinfo/python-list
source for the property function
Anyone know where the source code for the built-in property function is located in a python distribution? I would like to see how it works - mainly, how does it know which class it is being called from? Thanks, Rowland -- http://mail.python.org/mailman/listinfo/python-list
example of ssl with SimpleXMLRPCServer in 2.6?
Anyone have an example of using the new ssl module with SimpleXMLRPCServer in 2.6? Thanks, -- -Rowland -- http://mail.python.org/mailman/listinfo/python-list
