Are you aware of https://docs.python.org/3.10/library/dataclasses.html? That essentially provides a way to generate the boilerplate without having to put it all in your code.
El mié, 16 feb 2022 a las 5:20, Avanish Gupta (<avanishco...@gmail.com>) escribió: > 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*:*~*$ > > > AvanishCodes - VMware Workstation 16 Player (No... > <https://drive.google.com/file/d/1I4rbwjr-l5eNqbNzpnY8QOGrXP-c3t_B/view?usp=drive_web> > > > Thanks and Regards > Avanish > > > On Mon, Feb 14, 2022 at 4:59 AM Avanish Gupta <avanishco...@gmail.com> > wrote: > >> Hi all >> I am Avanish, a junior from Indian Institute of Information Technology, >> Surat. >> I have written a simple script to generate class files based on command >> line arguments. It is quite simple in nature, but if improved and packaged >> as a part of the Python language feature, it has the potential to save a >> lot of time for the developers across the globe. >> Please check the package at https://pypi.org/project/classgen >> If I can be given a chance to work on it, I would like to do it in much >> more detail. I hope I am on the right track, and I seek the guidance of >> your expertise and experience. >> >> >> >> Thanks and regards >> > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/QTFEMW4ABOPDFXLGO75ZBJHDBW7D7QDE/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/3VYSHQ63D5ESC3QS4S2O7QZLXLJA2EPC/ Code of Conduct: http://python.org/psf/codeofconduct/