codingdir logo sitemap sitemap |
Home
PHP
C#
C++
ANDROID
JAVA
JAVASCRIPT
PYTHON

Python *apropos* command


By : , Category : python

apropos only searches the one-line summaries of all modules, not each docstring of each single function, as that wouldn't be feasable (already importing every single module as apropos does and searching it's docstring is quite some overhead).

And even if it would, in the case of add_axes it wouldn't find anything because your search term isn't part of the one-line description.

I'm affraid if you need such functionality, you'd need to implement it yourself.

ReLated :

Here's the way I found about apropos-internal.

  • C-h fapropos

  • In the *Help* buffer, moved the point to the apropos.el and RET.

  • The later opened apropos.el at the function definition, which, all it does, basically, it calls the apropos-internal. M-. (requires elisp-slime-nav), or you could repeat the C-h f procedure. Will take you to the C Emacs sources, where apropos-internal is defined.

CL-USER> (documentation 'power 'function)

and it just returned NIL but as you can see from the list above given by apropos, power exists!

The symbol power exists, but note that it's not bound or fbound like some of the other symbols are. Thus is doesn't have a function or value binding. Lots of symbols exist, even if they don't have a function or value binding. This can be particularly frustrating in apropos, because if you do (apropos 'name), then in reading the form, you've already ensured that there's a symbol name. Sometimes you'll see people use the uninterned symbol notation to avoid this problem. E.g.:

CL-USER> (apropos 'this-already-got-interned)
THIS-ALREADY-GOT-INTERNED
; No value
CL-USER> (apropos '#:but-this-didnt!)
; No value

However, even if power did have a function or value binding, there's no guarantee that there'd be documentation available for it. Note that the documentation for documentation says:

Documentation strings are made available for debugging purposes. Conforming programs are permitted to use documentation strings when they are present, but should not depend for their correct behavior on the presence of those documentation strings. An implementation is permitted to discard documentation strings at any time for implementation-defined reasons.

That said, you can still try, and sometimes you'll get useful results:

CL-USER> (apropos '#:expt)
EXPT (fbound)
SB-C::EXPT-DERIVE-TYPE-AUX (fbound)
SB-C::EXPT-DERIVE-TYPE-OPTIMIZER (fbound)
...
; No value
CL-USER> (documentation 'expt 'function)
"Return BASE raised to the POWER."

In general, if you want to know more about an object, you can use describe (sds pointed this out before I did). The output isn't specifically defined, but it may well include the documentation:

CL-USER> (describe 'expt)
COMMON-LISP:EXPT
  [symbol]

EXPT names a compiled function:
  Lambda-list: (BASE POWER)
  Declared type: (FUNCTION (NUMBER NUMBER) (VALUES NUMBER &OPTIONAL))
  Documentation:
    Return BASE raised to the POWER.
  Source file: SYS:SRC;CODE;IRRAT.LISP
; No value

In general, these tools can be useful, but if you're looking for a particular function to achieve some task, Google is probably going to be more helpful unless you've already got a good idea of what you're looking for. After all, the first result in a Google search for “common lisp hyperspec exponent power” is a link to the page for expt.

This is nothing to do with command arguments or passing them on, but a basic misunderstanding of strings. You have a hard-coded string containing the word "file", you are not actually passing in the value of the file variable anywhere. You can use string substitution:

data = os.popen('ar t {}'.format(file)).read()

or

data = os.popen('ar t %s' % file).read()

Unless you want to open a new console window you don't need to run cmd.exe (%COMSPEC%) in order to run another Python script as a subprocess:

import sys
from subprocess import check_call

check_call([sys.executable, "C:\examples\xml2html.py",
            "--dir", "c:\Temp\abcd", "c:\tmp\results.xml"])
Comments


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © codingdir.com All Rights Reserved .