This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: initial modules.texi



I would like to add that we should have something as simple and
straightforward (for use in most situations) as Python's module
approach.

In case you don't know Python, you can import a module with

	import string

in which case all the functions in the "string" API are accessed with

	string.atof(...)

and so forth.

Or you can import individual functions from module string, in which
case they enter the global namespace:

	from string import atof, atoi
	...
	atof(...)
	atoi(...)

You can also do (not recommended for most situations):

	from string import *

in which case all functions in module string are available in the
global namespace.

There is also a Python primitive dir() which allows you to see what
symbols are exported by a module:

>>> import string
>>> dir(string)
['__builtins__', '__doc__', '__file__', '__name__', '_idmap', '_idmapL', '_lower', '_swapcase', '_upper', 'atof', 'atof_error', 'atoi', 'atoi_error', 'atol', 'atol_error', 'capitalize', 'capwords', 'center', 'count', 'digits', 'expandtabs', 'find', 'hexdigits', 'index', 'index_error', 'join', 'joinfields', 'letters', 'ljust', 'lower', 'lowercase', 'lstrip', 'maketrans', 'octdigits', 're', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'safe_env', 'split', 'splitfields', 'strip', 'swapcase', 'translate', 'upper', 'uppercase', 'whitespace', 'zfill']
>>> 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]