Search Results

Search found 106 results on 5 pages for 'ipython'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Ipython and Matplotlib in Ubuntu 13.10

    - by LuizAngioletti
    I've recently updated my Ubuntu to the 13.10 version. To my surprise, Ipython and Matplotlib are available only in versions prior to those I had in my previous 12.04 LTS install. When with the 12.04, I had the Julian Taylor PPA set up in my repositories, and that's why (I think) I had most up-to-date versions from both packages. The versions currently in 13.10 are: Matplotlib: 1.2.1 (http://matplotlib.org/index.html, most current version is 1.3.1) Ipython: 0.13.2 (http://ipython.org, most current version is 1.1.0 – September 2013) Is there any PPA available for the 13.10? The JTaylor ppa covers only as far as 12.10 (Quantal, link not available due to reputation rank in stack exchange) Should I install those packages outside apt? Isn't that troublesome?

    Read the article

  • How to integrate a Ipython console in a PyQT application

    - by user1800689
    I am developing PyQt software for my lab. In this software, I am loading different kind of RAW and analyzed data from a mySQL database (usually in arrays). I would like to integrate an Iython console in a Widget, so that I could interact easily with these data. I had some difficulties with Ipython 0.13 to do this. Here is what I already have (The whole code is very long, so I just show the part containing the widget, the Ipython console and the corresponding import line, if you need more, just tell me): ##I load everything useful to my application, including the following line from IPython.frontend.qt.console.qtconsoleapp import IPythonQtConsoleApp ##then is my whole software ##here is a class containing the Graphical User Interface elements. A button call the following function. self.Shell_Widget is the widget containing the Ipython console, self.MainWindow is the application mainwindow def EmbeddedIpython(self): """ This function should launch an Ipython console """ self.Shell_Widget = QtGui.QDockWidget(self.MainWindow) #Widget creation self.MainWindow.addDockWidget(4,self.Shell_Widget) self.Shell_Widget.setMinimumSize(400,420) console = IPythonQtConsoleApp() #Console Creation console.initialize() console.start() self.Shell_Widget.show() So, as wanted, an Ipython console is launched, and seems to work, but I can not access the whole application variables ,arrays etc... I think the Ipython console is launched independently from my software, but here is my limit in programming... Does someone know how to launch Ipython within my application? Maybe a missing parameter, or a different way to integrate Ipython. for information, this doesn't work: Embedding IPython Qt console in a PyQt application Thank you for your help!!

    Read the article

  • iPython in Emacs. Quick code evaluation

    - by AmV
    Hi all, I would like to "send" code snippets to a iPython interpreter in Emacs 23.2 (Linux). I have two related questions about this: Q1: I have learned that Emacs provides ('shell-command-on-region') to run selected regions in a shell. I have set setq shell-file-name to my iPython path, but when I run M-| after selecting a region, Emacs prompts me the following: Shell command on region: and if I then type RET, I get the iPython man page on the *Shell Command Output* buffer, without the region being executed. Why? Q2: Assuming that I have already started an iPython shell in some other buffer in Emacs, is there a way of selecting a region in another buffer and "sending" this region to the already-started iPython shell? Thanks!

    Read the article

  • A Python IDE with Debugging and iPython Integration?

    - by skibum1981
    Does anyone know of a python IDE that has iPython as the interpreter? Using the standard interpreter just drives me nuts, as I've just grown to love using iPython and all the features it provides. To be honest, I'd rather code with a simple text editor + ipython than an IDE, but I love being able to set breakpoints with a click of a mouse, etc., so I'd like to combine both. Sorry if there's something out there and this is common knowledge. Any information/tips you can provide is GREATLY appreciated. Thanks!

    Read the article

  • IPython tab completion not working

    - by djpark121
    Tab completion on IPython seems not to be working. For example, import numpy numpy.<tab> simply adds a tab. import numpy num<tab> just adds a tab, too. Could you please suggest some possible causes for this problem? I am running Windows 7 and Python 2.6.5.

    Read the article

  • Good way to edit the previous defined class in ipython

    - by leo
    Hi, I am wondering a good way to follow if i would like to redefine the members of a previous defined class in ipython. say : I have defined a class intro like below, and later i want to redefine part of the function definition _print_api. Any way to do that without retyping it . class intro(object): def _print_api(self,obj): def _print(key): if key.startswith('_'): return '' value = getattr(obj,key) if not hasattr(value,im_func): doc = type(valuee).__name__ else: if value.__doc__ is None: doc = 'no docstring' else: doc = value.__doc__ return ' %s :%s' %(key,doc) res = [_print(element) for element in dir(obj)] return '\n'.join([element for element in res if element != '']) def __get__(self,instance,klass): if instance is not None: return self._print(instance) else: return self._print_api(klass)

    Read the article

  • Running iPython from the OSX terminal.

    - by Az
    So I'm going through the matplotlib documentation and prepared to use the iPython interactive Python shell with ipython -pylab. However I get this: Az's MBP:~ Az$ ipython -pylab -bash: ipython: command not found Did I fail to install iPython? I used easy_install as advised. Any ideas?

    Read the article

  • IPython doesn't work in Django shell

    - by Zemogle
    I've just recently switched over to using 64-bit Python 2.6.1 on Mac OS X 10.6 (Snow Leopard). IPython won't work with Django anymore, but IPython works from the command-line. The error says: shell = IPython.Shell.IPShell(argv=[]) AttributeError: 'module' object has no attribute 'Shell' I could use the ./manage.py --plain option, but it's not really a fix. Any help very gratefully received!

    Read the article

  • Help getting iPython to run from the OSX terminal.

    - by Azfar
    Hi there, Got a heads up from stackoverflow.com to ask the question here. I'm going through the matplotlib documentation and prepared to use the iPython interactive Python shell with ipython -pylab. However I get this: MBP:~ Me$ ipython -pylab -bash: ipython: command not found Did I fail to install iPython? I used easy_install as advised. Any ideas? Update Thought I'd just say that I found the iPython "executable" in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin after doing a Spotlight search. Still a little confused as to what to do.

    Read the article

  • matplotlib.pyplot/pylab not updating figure while isinteractive(), using ipython -pylab

    - by NumberOverZero
    There are a lot of questions about matplotlib, pylab, pyplot, ipython, so I'm sorry if you're sick of seeing this asked. I'll try to be as specific as I can, because I've been looking through people's questions and looking at documentation for pyplot and pylab, and I still am not sure what I'm doing wrong. On with the code: Goal: plot a figure every .5 seconds, and update the figure as soon as the plot command is called. My attempt at coding this follows (running on ipython -pylab): import time ion() x=linspace(-1,1,51) plot(sin(x)) for i in range(10): plot([sin(i+j) for j in x]) #see ** print i time.sleep(1) print 'Done' It correctly plots each line, but not until it has exited the for loop. I have tried forcing a redraw by putting draw() where ** is, but that doesn't seem to work either. Ideally, I'd like to have it simply add each line, instead of doing a full redraw. If redrawing is required however, that's fine. Additional attempts at solving: just after ion(), tried adding hold(True) to no avail. for kicks tried show() for ** The closest answer I've found to what I'm trying to do was at http://stackoverflow.com/questions/2310851/plotting-lines-without-blocking-execution, but show() isn't doing anything. I apologize if this is a straightforward request, and I'm looking past something so obvious. For what it's worth, this came up while I was trying to convert matlab code from class to some python for my own use. The original matlab (initializations removed) which I have been trying to convert follows: for i=1:time plot(u) hold on pause(.01) for j=2:n-1 v(j)=u(j)-2*u(j-1) end v(1)= pi u=v end Any help, even if it's just "look up this_method" would be excellent, so I can at least narrow my efforts to figuring out how to use that method. If there's any more information that would be useful, let me know.

    Read the article

  • Magic function `bash ` not found

    - by inspectorG4dget
    I have a bunch of simulations that I want to run on a high-performance cluster, on which I should make reservations to get computing time. Since the reservations are bounded by time, I am developing an automation script that I can scp into the cluster and run. This script will then download the relevant simulation files, run them, and upload the results. Part of this automation script is in bash (cp, scp, etc) and the rest is in python. In order to develop this automation, I am using an IPython notebook. So far, I've coded all the python automation stuff in my IPython notebook and am trying to write the bash part of it now. However, it seems that the magic %%bash doesn't work in my IPython notebook. I get the following error when I have this code in my cell: Cell %%bash echo hi Error File "<ipython-input-22-62ec98e35224>", line 3 echo hi ^ SyntaxError: invalid syntax On a whim, I tried this: Cell %%bash print "hi" Error hi ERROR: Magic function `bash` not found. So I tried this with %%system, %%! and %%shell. But none of those work; they all give me the same error. Why is this happening? How can I fix this? Metadata: IPython 0.13.dev Python 2.7.1 Mac OS X Lion

    Read the article

  • Prevent Python from caching the imported modules

    - by Olivier
    While developing a largeish project (split in several files and folders) in Python with IPython, I run into the trouble of cached imported modules. The problem is that instructions import module only reads the module once, even if that module has changed! So each time I change something in my package, I have to quit and restart IPython. Painful. Is there any way to properly force reloading some modules? Or, better, to somehow prevent Python from caching them? I tried several approaches, but none works. In particular I run into really, really weird bugs, like some modules or variables mysteriously becoming equal to None... The only sensible resource I found is Reloading Python modules, from pyunit, but I have not checked it. I would like something like that. A good alternative would be for IPython to restart, or restart the Python interpreter somehow. So, if you develop in Python, what solution have you found to this problem?

    Read the article

  • cannot override sys.excepthook

    - by Mert Nuhoglu
    I try to customize behavior of sys.excepthook as described by the recipe. in ipython: :import pdb, sys, traceback :def info(type, value, tb): : traceback.print_exception(type, value, tb) : pdb.pm() :sys.excepthook = info :-- >>> x[10] = 5 ------------------------------------------------- Traceback (most recent call last): File "<ipython console>", line 1, in <module> NameError: name 'x' is not defined >>> pdb.pm() is not being called. It seems that sys.excepthook = info doesn't work in my python 2.5 installation. What should I look into? Any suggestion? Thank you

    Read the article

  • How to embed a Python interpreter in a PyQT widget

    - by Mathias
    I want to be able to bring up an interactive python terminal from my python application. Some, but not all, variables in my program needs to be exposed to the interpreter. Currently I use a sub-classed and modified QPlainTextEdit and route all "commands" there to eval or exec, and keep track of a separate namespace in a dict. However there got to be a more elegant and robust way! How? Here is an example doing just what I want, but it is with IPython and pyGTK... http://ipython.scipy.org/moin/Cookbook/EmbeddingInGTK

    Read the article

  • How to reload Django models without losing my locals in an interactive session?

    - by Gj
    I'm doing some research with an interactive shell and using a Django app (shell_plus) for storing data and browsing it using the convenient admin. Occasionally I add or change some of the app models, and run a syncdb (or South migration when changing a model). The changes to the models don't take effect in my interactive session even if I re-import the app models. Thus I'm forced to restart the shell_plus and lose my precious locals() in the process. Is there any way to reload the models during a session? Thanks!!

    Read the article

  • Session management error: None of the authentication protocols specified are supported

    - by JBWhitmore
    The title is the first error that has sent me on a mission to fix things. Motivation: I was trying to install the new Enthought Python Distribution -- when the error above first showed up. The install finished -- and looked like there were a few more times it flagged dcopserver problems: Please check that "dcopserver" program is running! Could not read network connection list: ~/home/user/.DCOPserver_host__0 When running ipython from the distribution, it claims that readline (the ability to up arrow in history or tab-complete) is not available for my system. It is though -- if I run the ipython that's sitting in /usr/bin/ipython all readline features work perfectly. So, I tried to fix the install by trying to fix what I thought could be causing the problems. Bad things that are happening that I want to be fixed: When restarting I get the error: Could not update ICEauthority file /home/username/.ICEauthority. ipython readline doesn't work with Enthought's ipython Things I have tried: changed the owner of my ~/.ICEauthority to be me. changed the owner of home directory (and all nested files and folders) to be me double checked that /var/lib/gdm was owned by Gnome (yep) attempted to reinstall DCOP, kbuildsycoca stuff (fail) I've removed nautilus; rebooted; reinstalled; rebooted; removed ubuntu-desktop; rebooted; reinstalled; rebooted. Any suggestions on how to fix the Bad Things that are happening would be greatly appreciated! Computer: Ubuntu 10.04 x86

    Read the article

  • Python version priority in OSX/UNIX PATH environment variable

    - by mindthief
    Hi all, I want my system to use /usr/bin/python, but it's currently using /opt/local/bin/python, which points to /usr/bin/python2.6. I tried modifying the PATH variable in my .bashrc as PATH=~/bin:$PATH ...and then set a symbolic link in ~/bin to point to /usr/bin/python. i.e. ~/bin/python --> /usr/bin/python I figured this might prioritize this symlink over the /opt/local version if it came before the other one in the PATH variable, but when I opened a new shell I still found python pointing to /opt/local/bin. Any advice on a good way to get the system to use /usr/bin/python? Also, I usually use ipython as opposed to python directly. I'm assuming that if the system starts to use the correct version of python then ipython would also use that version? If not, how could I also get ipython to use the correct version? Thanks!

    Read the article

  • Followup: Python 2.6, 3 abstract base class misunderstanding

    - by Aaron
    I asked a question at Python 2.6, 3 abstract base class misunderstanding. My problem was that python abstract base classes didn't work quite the way I expected them to. There was some discussion in the comments about why I would want to use ABCs at all, and Alex Martelli provided an excellent answer on why my use didn't work and how to accomplish what I wanted. Here I'd like to address why one might want to use ABCs, and show my test code implementation based on Alex's answer. tl;dr: Code after the 16th paragraph. In the discussion on the original post, statements were made along the lines that you don't need ABCs in Python, and that ABCs don't do anything and are therefore not real classes; they're merely interface definitions. An abstract base class is just a tool in your tool box. It's a design tool that's been around for many years, and a programming tool that is explicitly available in many programming languages. It can be implemented manually in languages that don't provide it. An ABC is always a real class, even when it doesn't do anything but define an interface, because specifying the interface is what an ABC does. If that was all an ABC could do, that would be enough reason to have it in your toolbox, but in Python and some other languages they can do more. The basic reason to use an ABC is when you have a number of classes that all do the same thing (have the same interface) but do it differently, and you want to guarantee that that complete interface is implemented in all objects. A user of your classes can rely on the interface being completely implemented in all classes. You can maintain this guarantee manually. Over time you may succeed. Or you might forget something. Before Python had ABCs you could guarantee it semi-manually, by throwing NotImplementedError in all the base class's interface methods; you must implement these methods in derived classes. This is only a partial solution, because you can still instantiate such a base class. A more complete solution is to use ABCs as provided in Python 2.6 and above. Template methods and other wrinkles and patterns are ideas whose implementation can be made easier with full-citizen ABCs. Another idea in the comments was that Python doesn't need ABCs (understood as a class that only defines an interface) because it has multiple inheritance. The implied reference there seems to be Java and its single inheritance. In Java you "get around" single inheritance by inheriting from one or more interfaces. Java uses the word "interface" in two ways. A "Java interface" is a class with method signatures but no implementations. The methods are the interface's "interface" in the more general, non-Java sense of the word. Yes, Python has multiple inheritance, so you don't need Java-like "interfaces" (ABCs) merely to provide sets of interface methods to a class. But that's not the only reason in software development to use ABCs. Most generally, you use an ABC to specify an interface (set of methods) that will likely be implemented differently in different derived classes, yet that all derived classes must have. Additionally, there may be no sensible default implementation for the base class to provide. Finally, even an ABC with almost no interface is still useful. We use something like it when we have multiple except clauses for a try. Many exceptions have exactly the same interface, with only two differences: the exception's string value, and the actual class of the exception. In many exception clauses we use nothing about the exception except its class to decide what to do; catching one type of exception we do one thing, and another except clause catching a different exception does another thing. According to the exception module's doc page, BaseException is not intended to be derived by any user defined exceptions. If ABCs had been a first class Python concept from the beginning, it's easy to imagine BaseException being specified as an ABC. But enough of that. Here's some 2.6 code that demonstrates how to use ABCs, and how to specify a list-like ABC. Examples are run in ipython, which I like much better than the python shell for day to day work; I only wish it was available for python3. Your basic 2.6 ABC: from abc import ABCMeta, abstractmethod class Super(): __metaclass__ = ABCMeta @abstractmethod def method1(self): pass Test it (in ipython, python shell would be similar): In [2]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods method1 Notice the end of the last line, where the TypeError exception tells us that method1 has not been implemented ("abstract methods method1"). That was the method designated as @abstractmethod in the preceding code. Create a subclass that inherits Super, implement method1 in the subclass and you're done. My problem, which caused me to ask the original question, was how to specify an ABC that itself defines a list interface. My naive solution was to make an ABC as above, and in the inheritance parentheses say (list). My assumption was that the class would still be abstract (can't instantiate it), and would be a list. That was wrong; inheriting from list made the class concrete, despite the abstract bits in the class definition. Alex suggested inheriting from collections.MutableSequence, which is abstract (and so doesn't make the class concrete) and list-like. I used collections.Sequence, which is also abstract but has a shorter interface and so was quicker to implement. First, Super derived from Sequence, with nothing extra: from abc import abstractmethod from collections import Sequence class Super(Sequence): pass Test it: In [6]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods __getitem__, __len__ We can't instantiate it. A list-like full-citizen ABC; yea! Again, notice in the last line that TypeError tells us why we can't instantiate it: __getitem__ and __len__ are abstract methods. They come from collections.Sequence. But, I want a bunch of subclasses that all act like immutable lists (which collections.Sequence essentially is), and that have their own implementations of my added interface methods. In particular, I don't want to implement my own list code, Python already did that for me. So first, let's implement the missing Sequence methods, in terms of Python's list type, so that all subclasses act as lists (Sequences). First let's see the signatures of the missing abstract methods: In [12]: help(Sequence.__getitem__) Help on method __getitem__ in module _abcoll: __getitem__(self, index) unbound _abcoll.Sequence method (END) In [14]: help(Sequence.__len__) Help on method __len__ in module _abcoll: __len__(self) unbound _abcoll.Sequence method (END) __getitem__ takes an index, and __len__ takes nothing. And the implementation (so far) is: from abc import abstractmethod from collections import Sequence class Super(Sequence): # Gives us a list member for ABC methods to use. def __init__(self): self._list = [] # Abstract method in Sequence, implemented in terms of list. def __getitem__(self, index): return self._list.__getitem__(index) # Abstract method in Sequence, implemented in terms of list. def __len__(self): return self._list.__len__() # Not required. Makes printing behave like a list. def __repr__(self): return self._list.__repr__() Test it: In [34]: a = Super() In [35]: a Out[35]: [] In [36]: print a [] In [37]: len(a) Out[37]: 0 In [38]: a[0] --------------------------------------------------------------------------- IndexError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() /home/aaron/projects/test/test.py in __getitem__(self, index) 10 # Abstract method in Sequence, implemented in terms of list. 11 def __getitem__(self, index): ---> 12 return self._list.__getitem__(index) 13 14 # Abstract method in Sequence, implemented in terms of list. IndexError: list index out of range Just like a list. It's not abstract (for the moment) because we implemented both of Sequence's abstract methods. Now I want to add my bit of interface, which will be abstract in Super and therefore required to implement in any subclasses. And we'll cut to the chase and add subclasses that inherit from our ABC Super. from abc import abstractmethod from collections import Sequence class Super(Sequence): # Gives us a list member for ABC methods to use. def __init__(self): self._list = [] # Abstract method in Sequence, implemented in terms of list. def __getitem__(self, index): return self._list.__getitem__(index) # Abstract method in Sequence, implemented in terms of list. def __len__(self): return self._list.__len__() # Not required. Makes printing behave like a list. def __repr__(self): return self._list.__repr__() @abstractmethod def method1(): pass class Sub0(Super): pass class Sub1(Super): def __init__(self): self._list = [1, 2, 3] def method1(self): return [x**2 for x in self._list] def method2(self): return [x/2.0 for x in self._list] class Sub2(Super): def __init__(self): self._list = [10, 20, 30, 40] def method1(self): return [x+2 for x in self._list] We've added a new abstract method to Super, method1. This makes Super abstract again. A new class Sub0 which inherits from Super but does not implement method1, so it's also an ABC. Two new classes Sub1 and Sub2, which both inherit from Super. They both implement method1 from Super, so they're not abstract. Both implementations of method1 are different. Sub1 and Sub2 also both initialize themselves differently; in real life they might initialize themselves wildly differently. So you have two subclasses which both "is a" Super (they both implement Super's required interface) although their implementations are different. Also remember that Super, although an ABC, provides four non-abstract methods. So Super provides two things to subclasses: an implementation of collections.Sequence, and an additional abstract interface (the one abstract method) that subclasses must implement. Also, class Sub1 implements an additional method, method2, which is not part of Super's interface. Sub1 "is a" Super, but it also has additional capabilities. Test it: In [52]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods method1 In [53]: a = Sub0() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Sub0 with abstract methods method1 In [54]: a = Sub1() In [55]: a Out[55]: [1, 2, 3] In [56]: b = Sub2() In [57]: b Out[57]: [10, 20, 30, 40] In [58]: print a, b [1, 2, 3] [10, 20, 30, 40] In [59]: a, b Out[59]: ([1, 2, 3], [10, 20, 30, 40]) In [60]: a.method1() Out[60]: [1, 4, 9] In [61]: b.method1() Out[61]: [12, 22, 32, 42] In [62]: a.method2() Out[62]: [0.5, 1.0, 1.5] [63]: a[:2] Out[63]: [1, 2] In [64]: a[0] = 5 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: 'Sub1' object does not support item assignment Super and Sub0 are abstract and can't be instantiated (lines 52 and 53). Sub1 and Sub2 are concrete and have an immutable Sequence interface (54 through 59). Sub1 and Sub2 are instantiated differently, and their method1 implementations are different (60, 61). Sub1 includes an additional method2, beyond what's required by Super (62). Any concrete Super acts like a list/Sequence (63). A collections.Sequence is immutable (64). Finally, a wart: In [65]: a._list Out[65]: [1, 2, 3] In [66]: a._list = [] In [67]: a Out[67]: [] Super._list is spelled with a single underscore. Double underscore would have protected it from this last bit, but would have broken the implementation of methods in subclasses. Not sure why; I think because double underscore is private, and private means private. So ultimately this whole scheme relies on a gentleman's agreement not to reach in and muck with Super._list directly, as in line 65 above. Would love to know if there's a safer way to do that.

    Read the article

  • Pinning ipython3 qtconlsole to launcher

    - by phg
    I've installed both ipython (which uses Python 2.7) and ipython3, and the respective qtconsole packages. Both work when I call them from the terminal like ipython qtconsole. However, when I search for them in the dash home, only the 2.7 versions (of both the shell and qtconsole) appear, as executables. Searching for ipython3 only yields the ipython3 file from /usr/bin. Changing to the "application lens" doesn't affect the results. Also, even if I can start both from the terminal, I can only pin the running 2.7 version to the launcher -- or, to be more exact, I can pin the v3 console, but the icon looks somehow blurred, and it doesn't start anything when I click it. So, whats happening here? Is the v3 package hidden somehow?

    Read the article

  • Python evaluation order

    - by d.m
    Here's the code, I don't quite understand, how does it work. Could anyone tell, is that an expected behavior? $ipython In [1]: 1 in [1] == True Out[1]: False In [2]: (1 in [1]) == True Out[2]: True In [3]: 1 in ([1] == True) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/dmedvinsky/projects/condo/condo/<ipython console> in <module>() TypeError: argument of type 'bool' is not iterable In [4]: from sys import version_info In [5]: version_info Out[5]: (2, 6, 4, 'final', 0)

    Read the article

  • Easy ways to investigate unknown Python APIs

    - by jedi_coder
    When studying a snippet of unknown Python code, I occasionally bump into the varName.methodName() pattern. To figure out what's this, I shall study the code more, find where varName was instantiated, find its type. So if varName proves to be an instance of ClassName class, I would knew that methodName() is a method of ClassName. Sometimes varName == self and methodName() is a method of this class, or a method inherited from some other class, if the current class is subclassing some other classes. Are there quick ways / tools that could take 'methodName' as input, scan over all installed Python modules and show which classes have methodName()? The closest thing related to this I know of is ipython. If I type a class name, then dot ('.') then TAB, it can show the class members. Instead of a class I could use a name of an object (which is an instance of a certain class) and it would work too. As soon as I choose a method name from the provided options, I can type '?' or '??' and get some help if there's a docstring. I wonder if ipython can do some intelligent scanning based only on 'methodName' string. If you know alternatives to ipython that could possibly help with this, please do suggest them.

    Read the article

1 2 3 4 5  | Next Page >