To add to the above answers:
Under JAR, an aircraft can only ever have one commander. If you are flying with an instructor, under instruction, whatever course it is you are training for, the instructor will be the commander and will log P1 (or PIC). You will log PUT.
(On the other hand, if you are carrying an instructor as a passenger - maybe because, after you get your PPL, you are planning a trip somewhere, and invite your ex-instructor to come along for the ride, then you will log P1 and the instructor does not log the flight. Hence why I needed to qualify the above paragraph with the "under instruction" phrase.)
There are only two times I can think of when you log P1 as you are undergoing a course of training. The first is as a solo student. The second is on the Flying Instructor Course, when carrying out mutual flying. For most of the FIC, you will fly with your instructor, so he will be captain. But the course allows up to a maximum of 5 hours of "mutual" flying where you "instruct" another FIC student for part of the PPL course. In this case, if you are the one "instructing", you are captain. (The student who is receiving the "instruction" does not get to log the flight, but still gets lots of benefit from it just the same.)
But, as LFS says, LASORS contains the full list of how to log time, so there may be some other circumstances that I've missed.
FFF
--------------