which hot key to do this

Hi Experts,

I'm learning the pycharm, and I visit the http://www.youtube.com/watch?v=PCgHVHhLBFY

I have two question about this video

1) which key to help create "self.name=name" autmatically

def __init__(self,name,description) (which key you pressed to generate below line? )
    self.name =name


2)
return self.name + "" + self.description
-------------> (Here, which key you pressed to replace with below line )
  return "%s %s" %(self.name,self.description)

sorry for my poor listening english,I can't catch what he said

Lei
4 comments
Comment actions Permalink
PyCharm offers intentions to perform these common actions (e.g. Add field for constructor parameter). You can either click on the light bulb and select the intention you want to perform or press Alt-Enter.  The same applies to your second question as well.
0
Comment actions Permalink
Thanks for your reminder, I have tried ALT-ENTER many times
for the question 1, it some times show "Add field for constructor parameter", but some times not show
for example:

a.if only keep it like
def __init__(self,name,description)
and then I press the alt-enter, it doesn't show "add filed.."
but
b. if it has something like below in pycharm
def __init__(self,name,description)
   return True
and then press alt-enter in line "def __init..", it show "add filed for..", and works for me
that's strange for me, I don't know what's wrong here.

==============

for
return self.name + "" + self.description
it never shows me "replace ...."
0
Comment actions Permalink
class Products(object):
    def __init__(self, name, description):
        pass

Doesn't show the intention for me as well. Frankly, I don't know why and if this is by design or a bug. I have filed an issue in YouTrack. You can watch the issue there to be notified about any changes.
0
Comment actions Permalink
Thanks for the support

Lei
0

Please sign in to leave a comment.