+ 1

How to create Python keywords for personal needs?

Hello! I want to have my own keywords like average, sum, .... I don't want to import module or write function.

5th Aug 2017, 10:33 AM
Seng Thai
Seng Thai - avatar
5 ответов
+ 14
You can using this 😊😊 sum(1,2) this is your keywords (function name) Python have enough keywords for using 😼😼
5th Aug 2017, 10:37 AM
Nithiwat
Nithiwat - avatar
+ 4
Without <<import module or write function >> you cannot define/create new << keywords >> (right word is "identifier" ^^)
5th Aug 2017, 10:42 AM
visph
visph - avatar
+ 4
@Martin: I haven't consider this option, as this would require more stuff than just write functions ;)
5th Aug 2017, 11:47 AM
visph
visph - avatar
+ 1
if you really don't want to implement functions or import modules, you would have to extend and compile your own version of python - but I see absolutely no reason for doing that.
5th Aug 2017, 11:45 AM
Martin Ed
Martin Ed - avatar
+ 1
@visph under normal circumstances I wouldn't have considered this neither - but his restrictions somehow don't leave room for other options :-)
5th Aug 2017, 12:03 PM
Martin Ed
Martin Ed - avatar