2017-02-07 2 views
3

En Python, il existe une liste des objets intégrés dir() et __builtin__.Le répertoire (l'objet) de Python et l'équivalent de __builtin__ dans Julia

>>> dir(__builtins__) 
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'] 

Y at-il une fonction dir() qui peut sonder des objets dans Julia?

Y a-t-il aussi une liste d'objets __builtin__ dans Julia?

+0

J'ai une macro que j'utilise pour cela. il est basé sur celui que j'ai posté [ici] (http://codereview.stackexchange.com/questions/138246/saving-the-values-of-all-variabled-declared-in-a-block). Ce n'est pas du calme, par exemple, il ignore les étendues imbriquées. Je peux corriger cela et le libérer comme un paquet à un moment donné –

Répondre

4

Les équivalents bruts sont les suivants:

  • names: renvoie les liaisons dans un module (éventuellement renvoie un-noms exporté avec second argument true).

  • fieldnames: renvoie les noms des champs d'objet.

Y at-il une liste de BUILTIN objets Julia?

Commencer par names(Base) et names(Core).