EH-Net

Ethical Hacking Discussions and Related Certifications => Programming => Topic started by: Thegmandrive on July 29, 2011, 11:17:56 AM



Title: Python 2 or Python 3
Post by: Thegmandrive on July 29, 2011, 11:17:56 AM
I have started to learn Python 3. I am very new to python, but am familiar with VB script. So some of the Python 3 syntax is making sense to me.

However, I have been reading about Python 2, and it seems many people still use it.

So my first question is.

Should I learn Python 2 and then learn Python 3?

Or, am I ok sticking with Python 3 for now.

I want to learn Python, for Iphone programming and script writing.

Also, I heard that python is useful for PEN testing. I assume however, that most PEN testers use python 2. Since it's been around much longer.
 


Title: Re: Python 2 or Python 3
Post by: chrisj on July 29, 2011, 11:53:37 AM
like perl 5, python 2 will be around for a while.  it'll take a while for everything to be converted over. Personally I'd go with Python 3. Only reason I mess with python 2 is because I have books on the subject.

There are scripts that will update 2 to 3. Learning 3, and then enough 2 to upgrade existing scripts might be a good choice to.


Title: Re: Python 2 or Python 3
Post by: Thegmandrive on July 29, 2011, 12:18:30 PM
Thank you for your reply, I will stick with Python 3 then for now. I really like the syntax so far in python 3, It's very "logical"


Title: Re: Python 2 or Python 3
Post by: tturner on July 29, 2011, 12:23:29 PM
I disagree. Name me 1 significant security tool written in 3. I don't know of any but I'd be happy to be mistaken.


Title: Re: Python 2 or Python 3
Post by: chrisj on July 30, 2011, 12:09:54 AM
tturner, I don't see how that is relevant. People write in the code they know. I'd rather make my security tools in Shell script and Perl. :)

If you're running other people's code than yeah, go with the interpreter that works for that code. But if you're writing fresh might as well go with the one that's maintained, and the developers are trying to get people to switch too.

From the pyhton wiki (http://wiki.python.org/moin/Python2orPython3)
Quote
Short version: Python 2.x is the status quo, Python 3.x is the shiny new thing.

At the time of writing (July 4, 2010), the final 2.7 release is out, with a statement of extended support for this end-of-life release. The 2.x branch will see no new major releases after that. 3.x is under active and continued development, with 3.2 already available.

Not dissing you, have respect, but I can't agree with you on this.


Title: Re: Python 2 or Python 3
Post by: tturner on July 30, 2011, 02:16:41 AM
It's a personal choice. For me, my desire to learn Python was not to write my own code as much as tweak the code in existing tools to suit my purpose and extend it's functionality and also to understand what is going on under the covers in the tools I'm using. So for that 2.x makes sense. By all means, use what works for you.


Title: Re: Python 2 or Python 3
Post by: chrisj on July 30, 2011, 06:39:55 PM
tturner, all good. that's a better argument. Showing you're using existing code to learn and do more. :)

Wasn't trying to knock you man. Just didn't see where you were coming from.


Title: Re: Python 2 or Python 3
Post by: ajohnson on August 02, 2011, 09:44:41 PM
Correct me if I'm wrong, but I believe the issue is that there are still many libraries that have not been updated to be compatible with v3. It's been awhile since I really looked at this, but it seems like this is still the consensus today. That seems like a valid reason to stay with v2 if you need additional functionality.