Skip to main content

Zope interfaces applied to Python builtins

Project description

dolmen.builtins provides a collection of interfaces representing the commonly used Python built-ins. It aims to make the component architecture useable with the most basic objects and to defines the types in order to extend them conveniently.

>>> from zope.interface import verify
>>> from dolmen.builtins import interfaces as base
>>> macduff = "Tis' a very nice string."
>>> base.IString.providedBy(macduff)
True
>>> macbeth = u"Aye, indeed my friend."
>>> base.IUnicode.providedBy(macbeth)
True
>>> is_usurper = True
>>> base.IBoolean.providedBy(is_usurper)
True
>>> crown = 1
>>> base.INumeric.providedBy(crown)
True
>>> king = 0.1
>>> base.INumeric.providedBy(king)
True
>>> opposants = 1L
>>> base.INumeric.providedBy(opposants)
True
>>> murderers = ('MacBeth', 'Lady MacBeth')
>>> base.ITuple.providedBy(murderers)
True
>>> victims = ['Banco', 'Duncan']
>>> base.IList.providedBy(victims)
True
>>> thanes = {"Glamis": "MacBeth", "Fife": "MacDuff"}
>>> base.IDict.providedBy(thanes)
True
>>> base.IIterable.providedBy(victims)
True
>>> base.IIterable.providedBy(murderers)
True
>>> base.IIterable.providedBy(thanes)
True
>>> verify.verifyObject(base.IDict, thanes)
True

Changelog

0.1 (2009-10-15)

  • Initial release [trollfot]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dolmen.builtins-0.1.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file dolmen.builtins-0.1.tar.gz.

File metadata

  • Download URL: dolmen.builtins-0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dolmen.builtins-0.1.tar.gz
Algorithm Hash digest
SHA256 139736fbc6eaf311ee0daf59f3f59ff9210308a56befd8144345912bca2dfe09
MD5 2e8a228ebadd20c8ed6d1048ea76c70f
BLAKE2b-256 c44e441d96babeb64ac9db7eb9dbf7d83e1d4418e01c6fd374551c7dc9134eba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page