Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2009, 01:17 PM   #1
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Python 3 - Safe to use/convert to?

Anybody trying to do work/convert their scripts to Python 3?

Any verdicts, problems, pitfalls you could share with the rest of us?

- Ahi
ahi is offline   Reply With Quote
Old 09-18-2009, 01:20 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,660
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Python 3 has changed enough so it's not backwards/forwards compatible. All the scripts used to remove DRm won't work with Python 3 and anything you code with Python 3 most likely won't work with 2.5.x or 2.6.x. So basically it's a botch job (IMHO) due to compatibility issues.
JSWolf is offline   Reply With Quote
Advert
Old 09-18-2009, 01:23 PM   #3
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by JSWolf View Post
Python 3 has changed enough so it's not backwards/forwards compatible. All the scripts used to remove DRm won't work with Python 3 and anything you code with Python 3 most likely won't work with 2.5.x or 2.6.x. So basically it's a botch job (IMHO) due to compatibility issues.
I was aware of the purposeful breaking of backwards/forwards compatibility. My question was more aimed at finding out whether people found it difficult to port their Python 2 scripts over to Python 3 and/or whether they found Python 3 easier or harder to program in.

When dealing with Unicode text, I get the impression it ought to be a bit more straightforward... but I fear pitfalls in this still rather young release.

Further clarification: I meant "convert to" in the sense of "converting scripts to", not in the sense of "switching your primary Python installation to". I rather agree with JSWolf that doing so would probably be foolhardy at this time... unless concurrent installations are possible, with Python 2 remaining the default.

- Ahi

Last edited by ahi; 09-18-2009 at 01:26 PM.
ahi is offline   Reply With Quote
Old 09-18-2009, 01:31 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,660
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
I don't think Python 3 will take off unless they can fix it so it also runs 2.5.x/2.6.x code without any modification.
JSWolf is offline   Reply With Quote
Old 09-18-2009, 01:35 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,778
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Python 3 is significantly slower because of it representing all string internally as ucs 2 or 4

Most 3rd party modules haven't been ported/have bugs with python 3

Note that using __future__ you can write code that will run correctly on both 2.6+ and 3.0. For new projects that's what I would recommend
kovidgoyal is offline   Reply With Quote
Advert
Old 09-18-2009, 01:39 PM   #6
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by JSWolf View Post
I don't think Python 3 will take off unless they can fix it so it also runs 2.5.x/2.6.x code without any modification.
I suspect there is no chance at all of any solution that literally has Python 3 providing compatibility.

Though, to be frank, I suspect that for those with a bit of system administration knowledge (like the Ubuntu maintainers, web hosts, et al) running both Python 2 and Python 3 concurrently is probably trivial. Hence I'm not convinced this is actually a problem.

Here's a list of changes/conversion notes for Python 3. My interest is piqued.

- Ahi
ahi is offline   Reply With Quote
Old 09-18-2009, 01:42 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,778
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I have python 2.4, 2.5, 2.6 and 3.1 on my machine
kovidgoyal is offline   Reply With Quote
Old 09-18-2009, 01:42 PM   #8
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Python 3 is significantly slower because of it representing all string internally as ucs 2 or 4

Most 3rd party modules haven't been ported/have bugs with python 3

Note that using __future__ you can write code that will run correctly on both 2.6+ and 3.0. For new projects that's what I would recommend
I have some Python code that works Extension Plane B CJK characters that aren't correctly handled by Python even as UTF-8... if Python 3 can recognize them and work with them cleanly, I shall be happy.

But I will check out __future__. Portability would still be nice. I'm guess though it is far from effortless.

Quote:
Originally Posted by kovidgoyal View Post
I have python 2.4, 2.5, 2.6 and 3.1 on my machine
Was it problematic to set them up?

- Ahi
ahi is offline   Reply With Quote
Old 09-18-2009, 01:50 PM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,778
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah, you have to know what you're doing to use __future__ correctly.

I use gentoo, a source based linux distro, which actually sets up the multiple python instances automatically for me
kovidgoyal is offline   Reply With Quote
Old 09-18-2009, 01:53 PM   #10
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Yeah, you have to know what you're doing to use __future__ correctly.

I use gentoo, a source based linux distro, which actually sets up the multiple python instances automatically for me
Ah, yes... I left Gentoo behind around the birth of my second daughter.

I now settle for whatever Ubuntu maintainers think up for me... with only the occasional attempts to try to do the inconvenient thing they did not think of doing.

- Ahi
ahi is offline   Reply With Quote
Old 09-18-2009, 01:56 PM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,778
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Python is designed to work well with multiple instances, so it shouldn't be hard to do.

Basically, just compile it from source and install into different prefixes, then setup appropriate symlinks pointing to the different versions in /usr/local/bin or wherever

And make sure you dont have any PYTHON* environment variables
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is ebook-convert thread safe? Takeshi_12 Calibre 3 05-12-2010 03:38 PM
Mirasol Displays..Safe? LDBoblo News 5 04-01-2010 07:39 PM
is it safe to.... Pushka Calibre 4 02-15-2010 07:52 AM
Accessories Want a safe Kindle 2 - what cover? Ea Amazon Kindle 26 10-24-2009 07:57 AM
Purchasing from jinke.com.cn. Is it safe? July HanLin eBook 12 07-23-2008 12:38 PM


All times are GMT -4. The time now is 02:45 AM.


MobileRead.com is a privately owned, operated and funded community.