In PyCharm 1.1, how to see PY source?

In pyCharm 1.0x when I viewed the declaration of a PY method or class, I was brought into the source.  This was true for debugging as well.  Although this could sometimes be a hassle, it could also be a nice and easy way to see the source and debug what's happening within Python itself.  That seems to have changed in 1.1.  Now when I step into a native Python method, the debugger steps right over it.  Going to declaration also just sends me to a DOC file where all the source is replaced with Pass.  How can I easily get to the source?

6 comments
Comment actions Permalink

Hello corey,

On which platform are you using PyCharm? Which are the file names for which

PyCharm steps into stubs rather than source code?

In pyCharm 1.0x when I viewed the declaration of a PY method or class,

I was brought into the source.  This was true for debugging as well.

Although this could sometimes be a hassle, it could also be a nice and

easy way to see the source and debug what's happening within Python

itself.  That seems to have changed in 1.1.  Now when I step into a

native Python method, the debugger steps right over it.  Going to

declaration also just sends me to a DOC file where all the source is

replaced with Pass.  How can I easily get to the source?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

I'm on Windows 7.  Any of the core Python code - like __builit__.class.  I'm pretty sure that I used to be able to get right into the source code when going to declaration.  Now the file I'm taken to is at \pycharm\system\python_stubs\

0
Comment actions Permalink

Hello corey,

The Python source code for the __builtins__ module doesn't exist, as the

module is implemented in C; showing the stubs is the only possibility. Many

other standard library modules are implemented in Python, and you're able

to navigate through their source code just fine.

I'm on Windows 7.  Any of the core Python code - like

__builit__.class.  I'm pretty sure that I used to be able to get right

into the source code when going to declaration.  Now the file I'm

taken to is at \pycharm\system\python_stubs\

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

That makes sense.  So the rest should be there then.

Thanks for the help.

0
Comment actions Permalink

This is a very valid feature request , as it exists in some Java IDE's and in MS Visual Studio for .Net .

The fact that all of Python's implementation is not in Python , does not negate the lack of this feature , which has long since been available in competing products .

Dmitry also dismissed my inquiry at StackOverflow , titled 'PyCharm Navigate to Python Source' , without taking time to consider . ( no link is provided as many moderators delete posts containing them )

 

Below is one of such Python class's that Dmitry insists doesn't exist , and this is exactly what we've asked for . The fact that it isn't the level of implementation we wanted , is not relevant .

# from Python's source at /Lib/typing.py

class List(list, MutableSequence[T]):

def __new__(cls, *args, **kwds):
if _geqv(cls, List):
raise TypeError("Type List cannot be instantiated; "
"use list() instead")
return list.__new__(cls, *args, **kwds)

 

There are of course many thousands of lines of open source Python source code that could be explored and used to write better Python code , and to do so more efficiently . Which is the very idea behind the PyCharm IDE , and any other IDE as well .

 

 
0
Comment actions Permalink

Jerome, I'm not sure I follow your logic. This class is not the implementation of the Python list. This class is used to mark a method parameter or return value as having the type `list`. What is the exact benefit of navigating to that code when you're asking PyCharm to navigate to the implementation of the Python list?

Navigating to the CPython source code is indeed a valid request, and it's possible that it will be eventually implemented now that we have a product (CLion) which combines C and Python support. But it doesn't seem to be what you want.

0

Please sign in to leave a comment.