Systers, an AnitaB.org community
Optimise current backend code with lambda expressions (Backend)
Description:
Review current backend code and see where we can optimise it using lambda expressions. For example replace this
users_list = UserModel.query.filter(UserModel.id != user_id).all()
list_of_users = []
for user in users_list:
if user.is_email_verified:
list_of_users += [user.json()]
]
with something like this:
users_list = UserModel.query.filter(UserModel.id != user_id).all()
list_of_users = filter(lambda user: user.is_email_verified, users_list)
Prerequisite:
- Have a GitHub account
- Know how to use git
- Setup and run the project on your local development environment
Action Items:
- Create a copy of the project into your account GitHub by forking systers/mentorship-backend project.
- Clone the project onto your local development environment
- Create a branch to make your changes
- Optimise the code using lambda expressions.
- Please make sure all tests pass after changes.
- Commit your change through the interface using our Commit message Style Guide.
- Submit a Pull Request, targeting
gci-dev
branch, following the template provided in the description.
Resources:
- If you need help or get lost, post a "New Topic" in the coding-backend-tasks stream.
- Pull request template at this link.
- Commit message Style Guide can be found here.
- How to fork, clone and setup remotes the project into your account wiki page can be found here.
- How to Use Python Lambda Functions
- 6 part series on Functional Prog.
Work Submission:
- Submit a link to Pull Request (PR) created with the change.
Task tags
Students who completed this task
_daksha_, asawesome07, HardikJH, i_maier