Cosmos: old codes are not supported in python 3

Created on 13 Mar 2018  路  13Comments  路  Source: OpenGenus/cosmos

This is a(n):

  • [ ] New algorithm
  • [x] Update to an existing algorithm
  • [ ] Error
  • [ ] Proposal to the Repository

Details:

Python 2 will be obsoleted in ~2 years. Some of your use python 2 functions like

  1. print
  2. xrange
  3. raw_input

Changes to be made

  1. import print from future
from __future__ import print_function
  1. change xrange to range
try:
   xrange = range
except NameError:
   pass
  1. change raw_input to range
try:
   input = raw_input
except NameError:
   pass

Most helpful comment

@tbhaxor By all means, go for it! :+1:

All 13 comments

I think a better change might be to just convert the code? But yes, a good early change would be to add snippets such as this. However, this should be replaced with pure python3 code in the future.

may i take the responsibility, after march ?

@tbhaxor By all means, go for it! :+1:

i believe in updating all code to py3

what do you think @AdiChat and @arnavb ?

I would like to work on this.

@mansiag @tbhaxor Sure, like I said, go for it! Python 2 is getting old...

@mansiag lemme take this :D
I have committed changes only 2 3 directories are left

@tbhaxor You've gone through nearly every single Python 2 file?

Wow... 馃憦 馃憦

@arnavb never doubt on my dedication :laughing:

@mansiag please allow me to open other Pull Request

@tbhaxor Can I work on this segment or should I delete this PR? I wont make any other changes. Thanks:smile:

@mansiag review all code in code/data_structures :smile:

@tbhaxor Thanks:smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaibhavsingh97 picture vaibhavsingh97  路  3Comments

skywalker212 picture skywalker212  路  3Comments

mansiag picture mansiag  路  3Comments

rhendz picture rhendz  路  4Comments

arthurlacoste picture arthurlacoste  路  3Comments