The Tur, who ruled according to Rabbi Shimon, wrote indeed with this wording: "One who extinguishes a lamp because he is afraid... where there is no danger—he is exempt but it is forbidden, and if there is danger—it is permitted ab initio. And if he extinguished it because he is sparing the lamp or the oil or the wick—he is exempt, and if he extinguished it in order to singe the wick—he is liable" Thus far his words, for this is 'needed for the body of the act of extinguishing,' so that the wick will be easy for the flame to take hold of, and therefore he must extinguish it and afterwards light it, and it is like extinguishing to make charcoal, which is called 'needed for its own sake.' Our teacher, the Beit Yosef, wrote only: "It is permitted to extinguish the lamp so that a patient who is in danger may sleep" Thus far his words. And he did not write more, as he did not wish to enter into this dispute, because in any event there is a rabbinic prohibition even according to Rabbi Shimon, and in all the laws of Shabbat our teachers, the authors of the Shulchan Aruch, did not enter into distinguishing except between that which is forbidden and that which is permitted, as I wrote in siman 242, see there. (And see the Taz who wrote that it is permitted to study before a wax candle, because there is no Torah prohibition in this when he trims the candle, for it is a melakhah she'einah tzerichah legufah, and we have already explained this in siman 275, section 7, that it is possible to say that there is also a prohibition of 'kindling' in this, see there. And what the Magen Avraham wrote regarding the words of the Kesef Mishneh chapter 1, on the difference between melakhah she'einah tzerichah legufah and a psik reisha, we have already explained in siman 242. And regarding what they questioned on the Tur, that he ruled in Choshen Mishpat siman 424 that one who wounds his fellow is exempt from payment because of 'kim leh bederava mineih,' and yet it is a melakhah she'einah tzerichah legufah—the matter is simple, for the Tur holds that just as one is liable for 'destructive' acts in wounding and kindling, so too he is liable for 'not needed for its own sake,' unlike the words of the Tosafot (75a) s.v. 'tefei', see there, and it will be explained in another place with the help of Heaven.)
והטור שפסק כרבי שמעון, כתב באמת בזה הלשון: "המכבה הנר מפני שהוא מתיירא… שאין בו סכנה - פטור אבל אסור, ואם יש בו סכנה - מותר לכתחלה. ואם כיבהו מפני שחס על הנר או על השמן או על הפתילה - פטור, ואם כיבהו כדי להבהב הפתילה - חייב" עכ"ל, דזהו צריך לגוף הכיבוי, כדי שתהא הפתילה נוחה לאחוז בה הלהב, ולכן צריך לכבותה ואחר כך להדליקה, והוה כמו כיבוי לעשות פחמין, דמיקרי צריך לגופה. ורבינו הב"י לא כתב רק: "מותר לכבות הנר בשביל שיישן החולה שיש בו סכנה" עכ"ל. ולא כתב יותר, שלא רצה ליכנס בפלוגתא זו, מפני שעל כל פנים איסור דרבנן יש גם לרבי שמעון, ובכל הלכות שבת לא נכנסו רבותינו בעלי הש"ע להפריש רק בין האסור ובין המותר, כמ"ש בסימן רמ"ב ע"ש. (ועיין ט"ז שכתב דמותר ללמוד בפני נר של שעוה, מפני שאין בזה איסור תורה כשימחוט הנר, דהוה מלאכה שאינה צריכה לגופה, וכבר בארנו בזה בסימן ער"ה סעיף ז', דאפשר לומר שיש בזה גם איסור מבעיר ע"ש. ומה שכתב המג"א בדברי הכסף משנה פרק א', בהפרש שבין מלאכה שאינה צריכה לגופה ובין פסיק רישא, כבר בארנו בסימן רמ"ב. ומה שהקשו על הטור דפסק בחושן משפט סימן תכ"ד דחובל בחבירו - פטור מתשלומין, משום 'קם ליה בדרבא מיניה', והא הוה מלאכה שאינה צריכה לגופה, הדבר פשוט דסבירא ליה להטור דכשם שחייב מקלקל בחובל ומבעיר, כמו כן חייב באין צריך לגופה, ושלא כדברי התוספות (ע"ה.) ד"ה 'טפי' ע"ש, ויתבאר במקום אחר בס"ד)