def info(object, spacing=10, collapse=1):
"""Print methods and doc strings.
Takes module, class, list, dictionary, or string."""
methodList = [method for method in dir(object) if callable(getattr(object, method))]
processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s)
print "\n".join(["%s %s" %
(method.ljust(spacing),
processFunc(str(getattr(object, method).__doc__)))
for method in methodList])
if __name__ == "__main__":
print info.__doc__
info([])
java代码:
/*
* Copyright (C) 2009 TopCoder Inc., All Rights Reserved.
*/
package com.chumbonus.model;
import java.util.List;
/**
*
* This is an entity class that represents the chum information.
*
*
* Thread Safety: This class is mutable and not thread safe.
*
*
* @author TCSDESIGNER, TCSDEVELOPER
* @version 1.0
*/
public class Chum extends AttributedObject {
/**
*
* Represents serial version UID.
*
*/
private static final long serialVersionUID = -3942260210581221144L;
/**
*
* Represents the list of referred jobs.
*
*
* It is initially null. It can be any value including null or empty. It can contain null element. It has
* corresponding getter and setter methods.
*
*/
private List<Job> referredJobs;
/**
*
* Represents the base user profile id of the chum.
*
*
* It is initially 0 and it can be any value. It has corresponding getter and setter methods.
*
*/
private long baseUserProfileId;
/**
*
* Creates a newChumobject.
*
*/
public Chum() {
}
/**
*
* Returns the list of referred jobs of the chum.
*
*
* @return the list of referred jobs.
*/
public List<Job> getReferredJobs() {
return referredJobs;
}
/**
*
* Updates the list of referred jobs of the chum with the specified value.
*
*
* @param referredJobs a list value to set as the list of referred jobs.
*/
public void setReferredJobs(List<Job> referredJobs) {
this.referredJobs = referredJobs;
}
/**
*
* Returns the base user profile id of the chum.
*
*
* @return the base user profile id of chum.
*/
public long getBaseUserProfileId() {
return baseUserProfileId;
}
/**
*
* Updates the base user profile id of chum with the specified value.
*
*
* @param baseUserProfileId a value to set as the base user profile id.
*/
public void setBaseUserProfileId(long baseUserProfileId) {
this.baseUserProfileId = baseUserProfileId;
}
}
2 条评论:
用什么着的色?插件?
我刚开始看python
恩,是一个插件,其实就是一个js文件,在后一篇blog中有说明。
另外,乌克兰童鞋,你们那边的大白猪养殖业怎么样啊,有没有受金融危机影响??
发表评论