Thanks for the previous mail.
I would like to highlight the value my thought offers to the developers. They often have to write classes while writing a module. In the class, they are supposed to write classes and objects. In a class, typically the attributes are private, and we have getters and setters to access and modify them. My thought is to automate the process of creating such class files with command line.
For this, I have made my initial attempt to create a module that does so. Here is a short video in which I am demonstrating it.
I am also attaching the details of my terminal to get a bit of more details.
I am looking forward to hearing from you if I should work on integrating it within the Python Language features, or I should go some other way round, or this is not a very useful tool for many people.
avanishcodes@avanishcodes:~$ echo "No Student.py file here"
No Student.py file here
avanishcodes@avanishcodes:~$ ls
Academics Documents node_modules Pictures snap Videos
bin Downloads package.json Projects Student.py
Desktop Music package-lock.json Public Templates
avanishcodes@avanishcodes:~$ rm Student.py
avanishcodes@avanishcodes:~$ ls
Academics Documents node_modules Pictures snap
bin Downloads package.json Projects Templates
Desktop Music package-lock.json Public Videos
avanishcodes@avanishcodes:~$ pip install classgen
Requirement already satisfied: classgen in ./.local/lib/python3.8/site-packages (0.0.7)
avanishcodes@avanishcodes:~$ python3 -m classgen Student member1,member2,member3,member4,member5,member6
Class Student generated successfully.
avanishcodes@avanishcodes:~$ cat Student.py
#(class) Student
class Student:
"""
This class is used to represent a Student.
Attributes:
member1: The member1 of the Student.
member2: The member2 of the Student.
member3: The member3 of the Student.
member4: The member4 of the Student.
member5: The member5 of the Student.
member6: The member6 of the Student.
Methods:
get_member1(self): Gets the member1 of the Student.
get_member2(self): Gets the member2 of the Student.
get_member3(self): Gets the member3 of the Student.
get_member4(self): Gets the member4 of the Student.
get_member5(self): Gets the member5 of the Student.
get_member6(self): Gets the member6 of the Student.
set_member1(self, member1): Sets the member1 of the Student.
set_member2(self, member2): Sets the member2 of the Student.
set_member3(self, member3): Sets the member3 of the Student.
set_member4(self, member4): Sets the member4 of the Student.
set_member5(self, member5): Sets the member5 of the Student.
set_member6(self, member6): Sets the member6 of the Student.
"""
_member1: None
_member2: None
_member3: None
_member4: None
_member5: None
_member6: None
def __init__(self, member1, member2, member3, member4, member5, member6):
"""
Initializes a Student object.
Params:
member1: The member1 of the Student.
member2: The member2 of the Student.
member3: The member3 of the Student.
member4: The member4 of the Student.
member5: The member5 of the Student.
member6: The member6 of the Student.
"""
self._member1 = member1
self._member2 = member2
self._member3 = member3
self._member4 = member4
self._member5 = member5
self._member6 = member6
def get_member1(self):
"""
Gets the member1 of the Student.
Returns:
get_member1: The member1 of the Student.
"""
return self._member1
def get_member2(self):
"""
Gets the member2 of the Student.
Returns:
get_member2: The member2 of the Student.
"""
return self._member2
def get_member3(self):
"""
Gets the member3 of the Student.
Returns:
get_member3: The member3 of the Student.
"""
return self._member3
def get_member4(self):
"""
Gets the member4 of the Student.
Returns:
get_member4: The member4 of the Student.
"""
return self._member4
def get_member5(self):
"""
Gets the member5 of the Student.
Returns:
get_member5: The member5 of the Student.
"""
return self._member5
def get_member6(self):
"""
Gets the member6 of the Student.
Returns:
get_member6: The member6 of the Student.
"""
return self._member6
def set_member1(self, member1):
"""
Sets the member1 of the Student.
Params:
member1: The member1 of the Student.
"""
self._member1 = member1
def set_member2(self, member2):
"""
Sets the member2 of the Student.
Params:
member2: The member2 of the Student.
"""
self._member2 = member2
def set_member3(self, member3):
"""
Sets the member3 of the Student.
Params:
member3: The member3 of the Student.
"""
self._member3 = member3
def set_member4(self, member4):
"""
Sets the member4 of the Student.
Params:
member4: The member4 of the Student.
"""
self._member4 = member4
def set_member5(self, member5):
"""
Sets the member5 of the Student.
Params:
member5: The member5 of the Student.
"""
self._member5 = member5
def set_member6(self, member6):
"""
Sets the member6 of the Student.
Params:
member6: The member6 of the Student.
"""
self._member6 = member6
avanishcodes@avanishcodes:~$
Thanks and Regards
Avanish