All Samples(90637) | Call(88276) | Derive(2345) | Import(16)
type(object) -> the object's type type(name, bases, dict) -> a new type
src/p/s/psycopg2da-2.0.9/examples/dict.py psycopg2da(Download)
data = curs.fetchone()
print "The type of the data row is", type(data)
print "Some data accessed both as tuple and dict:"
print " ", data['foo'], data['bar'], data['zot']
print " ", data[0], data[1], data[2]
# execute another query and demostrate we can still access the row
curs.execute("SELECT 2 AS foo")
print "The type of the data row is", type(data)
data = curs.fetchone()
print "The type of the data row is", type(data)
print "Some data accessed both as tuple and dict:"
print " ", data['foo'], data['bar'], data['zot']
print " ", "No access using indices: this is a specialized cursor."
# execute another query and demostrate we can still access the row
curs.execute("SELECT 2 AS foo")
print "The type of the data row is", type(data)
src/l/a/Langtangen-HEAD/src/py/examples/q4w/QAdata.py Langtangen(Download)
def usersAnswer(self, input):
if type(input) is type(''): # is input a string?
input = [input] # convert to list
self.user_input = input # list of strings
src/s/c/scipy-HEAD/scipy/weave/examples/dict_sort.py scipy(Download)
def c_sort(adict):
assert(type(adict) is dict)
code = """
#line 24 "dict_sort.py"
py::list keys = adict.keys();
def c_sort2(adict):
assert(type(adict) is dict)
code = """
#line 44 "dict_sort.py"
py::list keys = adict.keys();
src/s/c/scipy-HEAD/scipy/weave/examples/binary_search.py scipy(Download)
def c_int_search_scxx(seq,t,chk=1):
# do partial type checking in Python.
# checking that list items are ints should happen in py_to_scalar<int>
if chk:
assert(type(t) is int)
assert(type(seq) is list)
src/c/h/changingsong-HEAD/trunk/samples/config/configparser_test.py changingsong(Download)
bb1 = config2.get('RecentSongs', 'file1')
print ' file1:', type(bb1)
print bb1
bb2 = unicode(config2.get('RecentSongs', 'file2'), 'utf-8')
print ' file2:', type(bb2)
print bb2
bb3 = config2.get('RecentSongs', 'file3')
print ' file3:', type(bb3)
print bb3
bb4 = config2.get('RecentSongs', 'multipleitems')
print ' multipleitems', type(bb4)
print bb4
bb5 = config2.get('RecentSongs', 'maxitems')
print ' maxitems:', type(bb5)
src/c/h/changingsong-HEAD/trunk/samples/config/configobj_test.py changingsong(Download)
bb1 = config2['RecentSongs']['file1'] print ' file1:', type(bb1) print bb1 bb2 = config2['RecentSongs']['file2'] print ' file2:', type(bb2) print bb2 bb3 = config2['RecentSongs']['file3'] print ' file3:', type(bb3)
print bb3 bb4 = config2['RecentSongs']['multipleitems'] print ' multipleitems', type(bb4) print bb4 bb5 = config2['RecentSongs']['maxitems'] print ' maxitems:', type(bb5)
src/p/y/python-cookbook-HEAD/cb2_examples/cb2_6_12_sol_1.py python-cookbook(Download)
def _copy_container(self, container):
''' semi-shallow copy, recursing on container types only '''
new_container = copy.copy(container)
for k, v in self.containerItems[type(new_container)](new_container):
if type(v) in self.containerItems:
an 'isChanged' method, delegate to that method. Otherwise,
return True if the items differ. '''
if type(newitem) != type(olditem):
return True
if type(newitem) in self.containerItems:
src/p/o/polinax-HEAD/libs/external_libs/Genshi-0.5.1/examples/turbogears/genshitest/tests/test_controllers.py polinax(Download)
def test_method():
"the index method should return a string called now"
import types
result = testutil.call(cherrypy.root.index)
assert type(result["now"]) == types.StringType
src/w/e/WebStack-1.2.7/examples/Common/Form/__init__.py WebStack(Download)
# Detect uploads.
if type(value) not in (type(""), type(u"")):
value.reset()
details = "%s of length %s: %s" % (
src/d/j/django-navbar-0.3.0/examples/dbgp/_logging/handlers.py django-navbar(Download)
self.address = address
self.facility = facility
if type(address) == types.StringType:
self._connect_unixsocket(address)
self.unixsocket = 1
integers.
"""
if type(facility) == types.StringType:
facility = self.facility_names[facility]
if type(priority) == types.StringType:
"""
logging.Handler.__init__(self)
if type(mailhost) == types.TupleType:
host, port = mailhost
self.mailhost = host
self.mailport = None
self.fromaddr = fromaddr
if type(toaddrs) == types.StringType:
toaddrs = [toaddrs]
self.toaddrs = toaddrs
Previous 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 Next