R
R
reus2016-12-13 22:03:43
Python
reus, 2016-12-13 22:03:43

How can I learn more about methods/functions?

Python has a wonderful dir() function. It shows which methods/functions can be passed to our object. Example:
>>> a = [1, 2, 3]
>>> print dir(a)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__' , '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', ' __le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '
Is there something similar in GoLang? There is no console in Golang..

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya, 2016-12-13
@FireGM

No, because go is a statically typed language. Although using the reflect package you can. But if you use reflection, then something went wrong with you and / or you need a different programming language

A
abcd0x00, 2016-12-14
@abcd0x00

Python has a wonderful dir() function. It shows which methods/functions can be passed to our object.

No, it only shows names, and whose names they are, functions or variables, is unknown. Therefore, the maximum that is used in python is the help() function applied to an object. But even it does not give a complete picture of the object, since everything is often not described in such detail there, and in PyQt, in general, all method arguments are written with ellipsis. You eventually get used to reading only the main documentation, because the built-in one is not informative.
It's the same in Go: there is documentation - use it.
golang.org/ref/spec
golang.org/pkg

H
hitakiri, 2016-12-15
@hitakiri

Here are some packages implementing REPL

  • go-repl - junk
  • igo - junk
  • gore - relatively fresh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question