Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
How do I avoid hardcoding a django form?

```
class UserAnswerChoiceForm(forms.Form):
CHOICES = (
(None ,None),
(1, 'Disagree strongly'),
(2, 'Disagree a little'),
(3, 'Neither agree nor disagree'),
(4, 'Agree a little'),
(5, 'Agree strongly'),
)
answer_for_question_1 = forms.CharField(
widget=forms.Select(choices=CHOICES))
answer_for_question_2 = forms.CharField(
widget=forms.Select(choices=CHOICES))
and 43 more...

```

The logic is handled like so


```
if form.is_valid():
new_answer_group = SelfAnswerGroup.objects. create(user=request.user, user_profile=request.user.profile,)
for x in range(1, 45):
answer = UserAnswerChoice.objects.create(
user=request.user,


/r/django
https://redd.it/gq20t1
How much to rely on extensions?

As with my recent troubles with Flask-User, I'm trying to under how to balance the dependency on Flask Extensions, with not having to reinvent the wheel.

I first picked up Flask through a Udemy course, from which the instructor seemed to build most of the functionality from scratch, e.g. creating methods for the Database model to query from MongoDB, creating users and inserting their information.

But after the course, I've chanced upon the world of extensions, but I guess not all of them are actively maintained & may not exactly fit the requirements. Feeling slightly exasperated spending half a day trying to get Flask-User to register users into my MongoDB Atlas, but to no avail. Googling also didn't seem to yield much results...

How much do you guys utilize extensions?

/r/flask
https://redd.it/gq4u8a
Running a jupyter notebook on a server.

Hi, hello everyone,

I'm a physics teacher from Brazil and because of the quarantine i'm trying to make the lab classes on a virtual environment . I coded a physics simulation on python in a jupyter notebook file and i'm trying to make it accessible on a web page, like google **Colaboratory** (I tried to use google **Colaboratory, but some functions just wont work)**. Does someone know a guide/tutorial to make a running jupyter notebook file on a webpage ?

/r/JupyterNotebooks
https://redd.it/gpsdpz
I created "twenny" – my very first app! It reminds you to give your eyes a break every 20 minutes to prevent eye strain and is located in your menubar. You can download it on GitHub!

/r/Python
https://redd.it/gq8254
rq worker and redis

Hi,

i just startet to work with redis and rq worker. my test script is running and rq worker and the redis server are processing my tasks. everything runs perfectly fine. but the tasks I want to create for my project can take up to 12 minutes. they wait for a status on a different server.

let's say, i have 4 tasks.

task #1 takes 8 minutes

task #2 takes 12 minutes

task #3 takes 4 minutes

and finally task #4 takes 7 minutes.

is there a way to check if task #1 is done and if not put task #1 at the end of the queue and check task #2 and so on and so forth. Or do I have to wait until task #1 is done to continue with task #2.

In my perfect world I would get my feedback in the following order:

task #3, task #4, task #1 and finally task #2

thanks in advance

/r/flask
https://redd.it/gq7atw
This media is not supported in your browser
VIEW IN TELEGRAM
[Update] Shooting pose analysis and basketball shot detection [GitHub repo in comment]

/r/Python
https://redd.it/gqa7nt
[D] Simple Questions Thread May 24, 2020

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/gpxe3z
This media is not supported in your browser
VIEW IN TELEGRAM
After weeks of working on my smart house project I finally made something

/r/Python
https://redd.it/gqelgm
Missing ipynb files

Hi!

Im somewhat new to Python and Jupyter Notebook. I had some ipynb files created around 5 months ago. Few days ago I changed the location of the folder holding those files and now I can't find most of those ipynb files! Only 6 out of 20 files are somehow still there while the others are completely gone :| Can someone please explain why this happened and how to resolve it?

I obviously tried googling this, but couldn't find anything helpful.

Thank you :)

/r/JupyterNotebooks
https://redd.it/gqi161
My project after a week of self study Python. No tutorial, only uses google when I'm stuck. The code is short and simple.

/r/Python
https://redd.it/gqmyb4
Finding the shortest path between two points using the A Star Algorithm! I find it to be one of the best self projects to learn and get into programming. Link to the Github repository in the comments!

/r/Python
https://redd.it/gqp5jn
Demo for Mr. Beast's Self Updating Thumbnail with Python & Pillow

2 days ago, Mr. Beast came out with a video titled "I'm Giving My Friend $1 For Every 1,000 Views On This Video" with a Thumbnail which programmatically updates how much money his friend has made from the video based off the current view count.

Because of this, I decided to make a coding demo on how he did this with python and pillow: [https://www.youtube.com/watch?v=NCVIn8SnuJw](https://www.youtube.com/watch?v=NCVIn8SnuJw)

Let me know what y'all think!

/r/Python
https://redd.it/gqlhqd
[D] Uber AI's Contributions

As we learned last week, [Uber decided to wind down their AI lab](https://www.reddit.com/r/MachineLearning/comments/gm80x2/n_uber_to_cut_3000_jobs_including_rollbacks_on_ai/). Uber AI started as an acquisition of Geometric Intelligence, which was founded in October 2014 by three professors: Gary Marcus, a cognitive scientist from NYU, also well-known as an author; Zoubin Ghahramani, a Cambridge professor of machine learning and Fellow of the Royal Society; Kenneth Stanley, a professor of computer science at the University of Central Florida and pioneer in evolutionary approaches to machine learning; and Douglas Bemis, a recent NYU graduate with a PhD in neurolinguistics. Other team members included Noah Goodman (Stanford), Jeff Clune (Wyoming) and Jason Yosinski (a recent graduate of Cornell).

I would like to use this post as an opportunity for redditors to mention any work done by Uber AI that they feel deserves recognition. Any work mentioned here ([https://eng.uber.com/research/?\_sft\_category=research-ai-ml](https://eng.uber.com/research/?_sft_category=research-ai-ml)) or here ([https://eng.uber.com/category/articles/ai/](https://eng.uber.com/category/articles/ai/)) is fair game.

Some things I personally thought are worth reading/watching related to Evolutionary AI:

* [Welcoming the Era of Deep Neuroevolution](https://eng.uber.com/deep-neuroevolution/)
* [The surprising creativity of digital evolution: A collection of anecdotes from the evolutionary computation and artificial life research communities](https://eng.uber.com/research/the-surprising-creativity-of-digital-evolution-a-collection-of-anecdotes-from-the-evolutionary-computation-and-artificial-life-research-communities/)
* [Jeff Clune's Exotic Meta-Learning Lecture at Stanford](https://www.youtube.com/watch?v=cZUdaqTC1TA)
* [Kenneth Stanley's Lecture on On Creativity, Objectives, and Open-Endedness](https://www.youtube.com/watch?v=y2I4E_UINRo)
* Also, here's a summary by

/r/MachineLearning
https://redd.it/gqdq2o