This is an excellent question, and a source of some debate amongst professionals. I personally think that it is a risky endeavor, but those who have more faith than me say the following:
Be sure the surface is absolutely clean. However, do not pressure wash the walls as you will get too much water behind the siding which will come back to haunt you during the painting process.
Be sure to use an acrylic latex paint (some say a combination of urethane and acrylic paint).
Do not paint in direct sunlight.
Do not paint the vinyl a darker color that it already is. When exposed to sunshine, this will cause the vinyl to absorb a considerable amount of heat which will cause it to expand, warp, buckle and separate from the paint!
Once you paint the vinyl siding, you have eliminated one of the main features of a vinyl siding -- the fact that it is virtually maintenance free. Paint it once, and you begin to the cycle of repainting every few years.