a lock with a programming device , includes a stator , a rotor rotatably inserted therein , a keyhole , a longitudinal groove , a set of key followers and a set of locking pins which , under control of a change bar , can be mutually engaged for normal operation and disengaged in a change condition , and can be moved or blocked under control of a stop bar provided with springs which stress the stop bar outwards . the change bar is arranged to keep or assume , even in the change condition , a position in which it retains the engagement among at least some of the key followers and locking pins . a change element displaces the change bar to the position in which it disengages all the key followers from the locking pins , when the user intends to proceed with the change of the key . a device for preventing a faulty programming is provided .