Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to Python3 #112

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Convert to Python3 #112

wants to merge 11 commits into from

Conversation

ralic
Copy link

@ralic ralic commented May 18, 2017

using : find . -name '*.py' | xargs 2to3 -w

if not isinstance(app, cherrypy.Application):
continue
if not app.config:
continue
if sn == '':
continue
sn_atoms = sn.strip("/").split("/")
for key in app.config.keys():
for key in list(app.config.keys()):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be the following instead which is faster as when iterated over dicts simply return their keys:

for key in app.config:

@@ -91,7 +91,7 @@ def check_site_config_entries_in_app_config(self):

def check_skipped_app_config(self):
"""Check for mounted Applications that have no config."""
for sn, app in cherrypy.tree.apps.items():
for sn, app in list(cherrypy.tree.apps.items()):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting the generator returned by .items() to a list is going to make the for loop slower.

@Natim
Copy link
Contributor

Natim commented Sep 4, 2017

Python 2.7 is the fastest python

Not since Python 3.5 :D

@ghost
Copy link

ghost commented Nov 16, 2019

This should be reconsidered given Python2 reaching end-of-life in January.

@sametmax
Copy link
Contributor

sametmax commented Nov 18, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants