Starting with learning Python [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been working with PHP for about 7 months now, been in Object oriented for half year, and I find it quite easy.
Python's syntax isn't that hard, aswell.
I've been getting intersted in learning python, I started learning java 3 days ago, and got a bit boring (Since I used to work with websites all the time, I am not really interested in software programming).
A few questions about Python:
Python is not only used for webs, but also used for computer softwares. Is that correct?
Python is usually only used on huge systems such as Twitter, Google, and more, but is faster and more stable than PHP?
Is there a full tutorial, on how to set-up Python on XAMPP? I've never installed such things, just Xampp and MySQL. EDIT: How to start making websites with Python, I mean how do I install it?
In PHP, you simple make <? ?> tags or <?php ?>, do you do that in Python? if not, is that correct that you have to include HTML in python, the same way you do in a echo in PHP? echo "<span>hey</span>"?
That's all I wanted to know.
Thank you! I hope you can answer these questions for me.

Python is not only used for webs, but also used for computer softwares. Is that correct?
Definitely true. I have seen Python used for most types of computer software where you would also expect to find Java, C#, C, Matlab and so on.
Python is usually only used on huge systems such as Twitter, Google, and more, but is faster and more stable than PHP?
We use Python for some very large scale, 24x7 systems for a billions-of-dollars industry. But Python is also my language of choice when doing some quick-and-dirty evening hack for some hobby project.
I would not say that it is faster and/or more stable than PHP (I simply don't know), but for me, it makes me focus more on writing high quality code than any other dynamic language I've used. I think every language has a reason why it exists, and almost no language is better in all cases. For me, Python is the language of choice for web projects (unless I have to use Java for some external reason).
Is there a full tutorial, on how to set-up Python on XAMPP? I've never installed such things, just Xampp and MySQL.
I have no experience with XAMPP, but it seems a bit redundant in the Python world. I strongly recommend you to check out Django for web applications. In most production applications, I tie Django with NginX or lighty using FastCGI or the like. It is efficient and quick to set up.
In PHP, you simple make tags or , do you do that in Python? if not, is that correct that you have to include HTML in python, the same way you do in a echo in PHP? echo "hey"?
If you do check out Django, check out its template engine. It is really powerful while still simple (at least compared to ASP.Net which is the only major web template engine I've used before).

This is one of my favorite beginner guides, because it gets you started so quickly

Yes.
This is a subjective question. Following best practices, using efficient data structures, and using efficient algorithms will impact performance far more than any language differences. See this question for more details on "benchmarks," which again, do not really prove anything.
I would suggest this tutorial, it has you use mod_wsgi instead of executing Python scripts with CGI. You do not have to use the Django framework.
Most Python web frameworks will separate views and logic. Some templating engines will still allow you to use logic in templates. See this list for more information on templating engines.

Yes. Python can be used in a similar manner to PHP using Django and other such web frameworks, and it of course inherently can be used for any computing task, being turing complete and whatnot.
Python usually does most things faster than PHP, but stability and performance are affected more by the developer's skill than by the language choice.
I wouldn't know.
Yes, I believe that's how Django works, and other web frameworks ought to work the same. I'm not sure about inline code, because I think that's considered poor practice - you tend to make calls to external Python code, I believe. You typically do not write HTML in your Python code, although there might be libraries which build HTML from inside Python. (I wouldn't know, since I haven't done any web programming with Python.)
I'd also like to recommend you take the Python course at Codeacademy. It'll take you through the syntax, data structures, and neat features of Python; it's a step-by-step, interactive learning approach. It's basic, but a nice start which gives you feedback on your progress.

Python is used for large software projects yes. That is because you can easily link it to C and C++ but also because it is easy to do abstraction in Onject Oriented Style and because it has "Batteries included": e.g. a large STL.
By it self Python is not always the fastest, but because you can link it to C and C++ you gain performance. See comparison between PHP and Python and Java.
You should not start mixing Python and HTML. Instead you should learn a Python Webframework like Django. It will also save you the need to set up LAMP for the beginning, since Django has a built in HTTP server.
For getting starting with Python: http://learnpythonthehardway.org/
You should also get to know IPYTHON and python's packages. The former will help you inspecting objects and getting help quickly. The later is more then the Batteries included ...

1) Python is a general purpose language, like Java, C++, perl, ruby, etc.
2) Python is a general purpose language and can be applied to any problem. php is optimized for web programming, so it might be faster than python.
3) The first thing you want to do is just install the latest version of python on your system, and start messing around with writing short programs. You want to do that before you get involved in a more complicated setting, like web programming, where there are a lot of moving parts.
4) Python doesn't use script tags like php. Not to worry, many people consider mixing code and html to be bad practice.
I suggest you start with some simple cgi scripts. And then you can explore the many web frameworks for python. A web framework is usually a complex system, which you use to program your website. Read this overview of python and the web:
http://docs.python.org/2/howto/webservers.html

Related

Word game server in Python, design pros and cons?

I'd like to get busy with a winter programming project and am contemplating writing an online word game (with a server load of up to, say, 500 users simultaneously). I would prefer it to be platform independent. I intend to use Python, which I have some experience with. For user data storage, after previous experience with MySQL, a flat database design would be preferable but not essential. Okay, now the questions:
Is it worth starting with Python 3, or is it still too poorly supported with ports of modules from previous versions?
Are there any great advantages in using Python 3 for my particular project? Would I be better off looking at using other languages instead, such as Erlang?
Is there any great advantage in using a relational database within a game server?
Are there any open source game servers' source code out there that are worthy of study before starting?
I would go for Python + Django. It makes web application developments pretty easy.
Is it worth starting with Python 3, or is it still too poorly supported with ports of modules from previous versions?
depends on which modules do you want to use. twisted is a "swiss knife" for the network programming and could be a choice for your project but unfortunately it does not support python3 yet.
Are there any great advantages in using Python 3 for my particular project? Would I be better off looking at using other languages instead, such as Erlang?
only you can answer your question because only you know your knowledge. Using python3 instead of python2 you get all the advantages of new features the python3 brings with him and the disadvantage that non all libraries support python3 at the moment.
note that python2.6 should implements most (if not all) of the features of python3 while it should be compatible with python2.5 but i did not investigated a lot in this way.
both python and erlang are candidates for your needs, use what you know best and what you like most.
Is there any great advantage in using a relational database within a game server?
you get all the advantages and disadvantage of having a ACID storage system.
Related to your database choice, I'd seriously look at using Postgres instead of MySQL. In my experiance with the two Postgres has shown to be faster on most write operations while MySQL is slightly faster on the reads.
However, MySQL also has many issues some of which are:
Live backups are difficult at best, and impossible at worse, mostly you have to take the db offline or let it lock during the backups.
In the event of having to kill the server forcefully, either by kill -9, or due to power outage, postgres generally has better resilience to table corruption.
Full support for ACID compliance, and other relational db features that support for, again imho and experiance, are weak or lacking in MySQL.
You can use a library such as SQLAlchemy to abstract away the db access though. This would let you test against both to see which you prefer dealing with.
As far as the language choice.
If you go with Python:
More librarys support Python 2.x rather than Python 3.x at this time, so I'd likely stick to 2.x.
Beware multi-threading gotchas with Python's GIL. Utilizing Twisted can get around this.
If you go with Erlang:
Erlang's syntax and idioms can be very foreign to someone who's never used it.
If well written it not only scales, it SCALES.
Erlang has it's own highly concurrent web server named Yaws.
Erlang also has it's own highly scalable DBMS named Mnesia (Note it's not relational).
So I guess your choices could be really boiled down to how much you're willing to learn to do this project.
A project of this kind could be a great way of investigating a new language. I'd say that Erlang is one of the more interesting languages out there, (1) being functional, (2) offering a superb concurrency / (distributed) parallelism paradigm, (2) seeing use in the industry (most notably & traditionally telecommunications), (3) actually entering the desktop space (CouchDB). If you don't know it yet, go for it! :-)
As for open source game servers... Well, there's plenty. Google around for MUD engines etc. For starters, check out the Wikipedia entry on MOOs and look at LambdaMOO.
If you're already fairly familiar with Python, then I'd investigate the Twisted library if I were you. Twisted is an asynchronous comms library that was originally developed to support a large text-based game.
The current level of support for Python 3 by commonly used libraries is not high - so you probably want to stick with something like Python 2.6 at this point in time.

What is Python used for? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
What is Python used for and what is it designed for?
Python is a dynamic, strongly typed, object oriented, multipurpose programming language, designed to be quick (to learn, to use, and to understand), and to enforce a clean and uniform syntax.
Python is dynamically typed: it means that you don't declare a type (e.g. 'integer') for a variable name, and then assign something of that type (and only that type). Instead, you have variable names, and you bind them to entities whose type stays with the entity itself. a = 5 makes the variable name a to refer to the integer 5. Later, a = "hello" makes the variable name a to refer to a string containing "hello". Static typed languages would have you declare int a and then a = 5, but assigning a = "hello" would have been a compile time error. On one hand, this makes everything more unpredictable (you don't know what a refers to). On the other hand, it makes very easy to achieve some results a static typed languages makes very difficult.
Python is strongly typed. It means that if a = "5" (the string whose value is '5') will remain a string, and never coerced to a number if the context requires so. Every type conversion in python must be done explicitly. This is different from, for example, Perl or Javascript, where you have weak typing, and can write things like "hello" + 5 to get "hello5".
Python is object oriented, with class-based inheritance. Everything is an object (including classes, functions, modules, etc), in the sense that they can be passed around as arguments, have methods and attributes, and so on.
Python is multipurpose: it is not specialised to a specific target of users (like R for statistics, or PHP for web programming). It is extended through modules and libraries, that hook very easily into the C programming language.
Python enforces correct indentation of the code by making the indentation part of the syntax. There are no control braces in Python. Blocks of code are identified by the level of indentation. Although a big turn off for many programmers not used to this, it is precious as it gives a very uniform style and results in code that is visually pleasant to read.
The code is compiled into byte code and then executed in a virtual machine. This means that precompiled code is portable between platforms.
Python can be used for any programming task, from GUI programming to web programming with everything else in between. It's quite efficient, as much of its activity is done at the C level. Python is just a layer on top of C. There are libraries for everything you can think of: game programming and openGL, GUI interfaces, web frameworks, semantic web, scientific computing...
Why should you learn Python Programming Language?
Python offers a stepping stone into the world of programming. Even though Python Programming Language has been around for 25 years, it is still rising in popularity.
Some of the biggest advantage of Python are it's
Easy to Read & Easy to Learn
Very productive or small as well as big projects
Big libraries for many things
What is Python Programming Language used for?
As a general purpose programming language, Python can be used for multiple things. Python can be easily used for small, large, online and offline projects. The best options for utilizing Python are web development, simple scripting and data analysis. Below are a few examples of what Python will let you do:
Web Development:
You can use Python to create web applications on many levels of complexity. There are many excellent Python web frameworks including, Pyramid, Django and Flask, to name a few.
Data Analysis:
Python is the leading language of choice for many data scientists. Python has grown in popularity, within this field, due to its excellent libraries including; NumPy and Pandas and its superb libraries for data visualisation like Matplotlib and Seaborn.
Machine Learning:
What if you could predict customer satisfaction or analyse what factors will affect household pricing or to predict stocks over the next few days, based on previous years data? There are many wonderful libraries implementing machine learning algorithms such as Scikit-Learn, NLTK and TensorFlow.
Computer Vision:
You can do many interesting things such as Face detection, Color detection while using Opencv and Python.
Internet Of Things With Raspberry Pi:
Raspberry Pi is a very tiny and affordable computer which was developed for education and has gained enormous popularity among hobbyists with do-it-yourself hardware and automation. You can even build a robot and automate your entire home. Raspberry Pi can be used as the brain for your robot in order to perform various actions and/or react to the environment. The coding on a Raspberry Pi can be performed using Python. The Possibilities are endless!
Game Development:
Create a video game using module Pygame. Basically, you use Python to write the logic of the game. PyGame applications can run on Android devices.
Web Scraping:
If you need to grab data from a website but the site does not have an API to expose data, use Python to scraping data.
Writing Scripts:
If you're doing something manually and want to automate repetitive stuff, such as emails, it's not difficult to automate once you know the basics of this language.
Browser Automation:
Perform some neat things such as opening a browser and posting a Facebook status, you can do it with Selenium with Python.
GUI Development:
Build a GUI application (desktop app) using Python modules Tkinter, PyQt to support it.
Rapid Prototyping:
Python has libraries for just about everything. Use it to quickly built a (lower-performance, often less powerful) prototype. Python is also great for validating ideas or products for established companies and start-ups alike.
Python can be used in so many different projects. If you're a programmer looking for a new language, you want one that is growing in popularity. As a newcomer to programming, Python is the perfect choice for learning quickly and easily.

Drupal or Wordpress CMS as a Social Network? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am making a community for web-comic artist who will be able to sync their existing website to this site.
However, I am in debate for what CMS I should use: Drupal or Wordpress.
I have heard great things about Drupal, where it is really aimed for Social Networking. I actually got to play a little bit in the back end of Drupal and it seemed quite complicated to me, but I am not going to give up to fully understand how Drupal works.
As for Wordpress, I am very familiar with the Framework. I have the ability to extend it to do what I want, but I am hesitating because I think the framework is not built for communities (I think it may slow down in the future).
I also have a unrelated question as well: Should I go with a Python CMS?
I heard very great things about Python and how much better it is compare to PHP.
Your advice is appreciated.
Difficult decision. Normally I would say 'definitely Drupal' without hesitation, as Drupal was build as a System for community sites from the beginning, whereas Wordpress still shows its heritage as a blogging solution, at least that's what I hear quite often. But then I'm working with Drupal all the time recently and haven't had a closer look at Wordpress for quite a while.
That said, Drupal has grown into a pretty complex system over the years, so there is quite a learning curve for newcomers. Given that you are already familiar with Wordpress, it might be more efficient for you to go with that, provided it can do all that you need.
So I would recommend Drupal, but you should probably get some opinions from people experienced with Wordpress concerning the possibility to turn it into a community site first.
As for the Python vs. PHP CMS question, I'd say that the quality of a CMS is a function of the ability of its developers, the maturity of the system, the surrounding 'ecosystem', etc. and not of the particular language used to build it. (And discussions about the quality of one established language vs. another? Well - let's just not go there ;)
I make websites both using Drupal and Django - sometimes with Pinax (Python). So let me try to set up the differences between Python and PHP, and the different CMS's.
Python - PHP
Pros for Python.
You tend to write more readable code making it easier to maintain. This has a big impact if you are going to do a lot of custom coding, now or in the future. However if you aren't going to make that much custom functionality, this doesn't matters.
Python and Django is buildt on OO, making it easy to reuse code, and is built on the DRY princip.
I find, that python is more intuitive to program in. In many cases it has a less weird / obscure syntax than PHP.
Cons for Python.
PHP is easier to host. More providers will allow you to run PHP and you can generally find PHP hosters a bit more cheaper than python hosters. If you have your own server, this wont matter.
Generally it's easier to code with python in many regards, but this is something that can be overcome simply by using more time with PHP. Also if you don't know python, that means you will have to invest some time learning it, and the things you can do with python. On the other hand it's a bit more difficult to find cheap hosting for Python projects.
Django/Pinax vs Drupal vs Wordpress.
It's always difficult to be able to say, which CMS?CMF to use. Which to choose is dependent on several factors.
How much custom coding are you going to do?
How much customization do you need?
How fine grained control over the system do you want?
Wordpress' strength is it's ease of use, and how you quickly and easily can setup a lot of things. You might be able to get a site like what you want with only a few hours spent. The problem with wordpress however, is when you want to make custom functionality. It doesn't have a strong API like Drupal, and you might have problems changing the output to give you exactly what you want.
Drupal's great strength is it's powerfull API, ability to customize and overwrite anything. In addition to all this, it also has a lot of modules giving you the ability to in many cases build your most/all of your site in a very short time. The problem with Drupal is, that it's not easy to use. You have to spend time learning the system and API before you can take advantage of it. the Drupal AI is also hard to navigate for newcomers, and it takes a while before you learn where the different things are. Drupal is a big machine though, and it can get a bit slow, unless you setup something like Varnish in front of it.
Django is made for rapid development. So once you get into it, which isn't that hard, you can quickly create apps to suite your needs. You have complete control over the urls. The problem with django is that it's not so easy to find the different apps that has been made and figure out which are good. The template system makes it easy to make the markup like you want, but you can't change the functionality of the apps the same way you can with Drupal. One thing to note, is that Pinax doesn't have a 1.0 release yet, while Drupal is on code freeze for it's 7.0 release.
All in all, with all these tools, the biggest challenge is finding out how to use them. If you know wordpress very well and just want to make this one site, you can just use it and be done with it. If however you want to take it further, I would suggest that you use either Django or Drupal. These two has some great development potential.
If you're open to Python, and are building a social / community site, I would check out Pinax for the Django web framework. It provides a lot of common social site features like user accounts, blogging, tagging, friend invites, etc.
Here's an example of a social site built using Pinax.
There's a WordPress extension called BuddyPress that'll give you a ready-to-go social network. If it suits you, it may be an easier solution than a Drupal install. If it doesn't suit you, though, I find Drupal more suited to extending in the long run.
I'd do it Drupal as it's a proven social networking platform and has te ability to be upgraded to do just about anything, from the vast range of modules on offer (read up on cck and views- they basically let you add your own customised page type (cck) and views lets you show data in various different ways, and based on various other parameters.)
I run my own mini social network site in Drupal - Tunstall Communities - Bankeyfields,
Heres a social network/news site using Wordpress, which they've now opted to upgrade to Drupal, as they want more social networking features.
DrupalSN is a social network site designed for showing you how to build Drupal sites, and a lot of the Tutorials on there are focussed on user interaction, so it will be a great resource if you go with Drupal.

Which of these scripting languages is more appropriate for pen-testing? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it.
You probably want Ruby, because it's the native language for Metasploit, which is the de facto standard open source penetration testing framework. Ruby's going to give you:
Metasploit's framework, opcode and shellcode databases
Metasploit's Ruby lorcon bindings for raw 802.11 work.
Metasploit's KARMA bindings for 802.11 clientside redirection.
Libcurl and net/http for web tool writing.
EventMachine for web proxy and fuzzing work (or RFuzz, which extends the well-known Mongrel webserver).
Metasm for shellcode generation.
Distorm for x86 disassembly.
BinData for binary file format fuzzing.
Second place here goes to Python. There are more pentesting libraries available in Python than in Ruby (but not enough to offset Metasploit). Commercial tools tend to support Python as well --- if you're an Immunity CANVAS or CORE Impact customer, you want Python. Python gives you:
Twisted for network access.
PaiMei for program tracing and programmable debugging.
CANVAS and Impact support.
Dornseif's firewire libraries for remote debugging.
Ready integration with WinDbg for remote Windows kernel debugging (there's still no good answer in Ruby for kernel debugging, which is why I still occasionally use Python).
Peach Fuzzer and Sully for fuzzing.
SpikeProxy for web penetration testing (also, OWASP Pantera).
Unsurprisingly, a lot of web work uses Java tools. The de facto standard web pentest tool is Burp Suite, which is a Java swing app. Both Ruby and Python have Java variants you can use to get access to tools like that. Also, both Ruby and Python offer:
Direct integration with libpcap for raw packet work.
OpenSSL bindings for crypto.
IDA Pro extensions.
Mature (or at least reasonable) C foreign function interfaces for API access.
WxWindows for UI work, and decent web stacks for web UIs.
You're not going to go wrong with either language, though for mainstream pentest work, Metasploit probably edges out all the Python benefits, and at present, for x86 reversing work, Python's superior debugging interfaces edge out all the Ruby benefits.
Also: it's 2008. They're not "scripting languages". They're programming languages. ;)
[Disclaimer: I am primarily a Perl programmer, which may be colouring my judgement. However, I am not a particularly tribal one, and I think on this particular question my argument is reasonably objective.]
Perl was designed to blend seamlessly into the Unix landscape, and that is why it feels so alien to people with a mainly-OO background (particularly the Java school of OOP). For that reason, though, it’s incredibly widely installed on machines with any kind of Unixoid OS, and many vendor system utilities are written in it. Also for the same reason, servers that have neither Python nor Ruby installed are still likely to have Perl on them, again making it important to have some familiarity with. So if your CEH activity includes extensive activity on Unix, you will have to have some amount of familiarity with Perl anyway, and you might as well focus on it.
That said, it is largely a matter of preference. There is not much to differentiate the languages; their expressive power is virtually identical. Some things are a little easier in one of the languages, some a little easier in another.
In terms of libraries I do not know how Ruby and Python compare against each other – I do know that Perl has them beat by a margin. Then again, sometimes (particularly when you’re looking for libraries for common needs) the only effect of that is that you get deluged with choices. And if you are only looking to do things in some particular area which is well covered by libraries for Python or Ruby, the mass of other stuff on CPAN isn’t necessarily an advantage. In niche areas, however, it matters, and you never know what unforeseen need you will eventually have (err, by definition).
For one-liner use on the command line, Python is kind of a non-starter.
In terms of interactive interpreter environment, Perl… uhm… well, you can use the debugger, which is not that great, or you can install one from CPAN, but Perl doesn’t ship a good one itself.
So I think Perl does have a very slight edge for your needs in particular, but only just. If you pick Ruby you’ll probably not be much worse off at all. Python might inconvenience you a little more noticeably, but it too is hardly a bad choice.
I could make an argument for all three :-)
Perl has all of CPAN - giving you a huge advantage in pulling together functionality quickly. It also has a nice flexible testing infrastructure that means you can plug lots of different automated testing styles (including tests in other languages) in the same framework.
Ruby is a lovely language to learn - and lacks some of the cruft in Perl 5. If you're doing web based testing it also has the watir library - which is trez useful (see http://wtr.rubyforge.org/)
Python - nice language and (while it's not to my personal preference) some folk find the way its structured easier to get to grips with.
Any of them (and many others) would be a great language to learn.
Instead of looking at the language - I'd look at your working environment. It's always easier to learn stuff if you have other folk around who are doing similar stuff. If you current dev/testing folk are already focussed on one of the above - I'd go for that. If not, pick the one that would be most applicable/useful to your current working environment. Chat to the rest of your team and see what they think.
That depends on the implementation, if it will be distributed I would go with Java, seeing as you know that, because of its portability. If it is just for internal use, or will be used in semi-controlled environments, then go with whatever you are the most comfortable maintaining, and whichever has the best long-term outlook.
Now to just answer the question, I would go with Perl, but I'm a linux guy so I may be a bit biased in this.
If you plan on using Metasploit for pen-testing and exploit development I would recommend ruby as mentioned previously Metasploit is written in ruby and any exploit/module development you may wish to do will require ruby.
If you will be using Immunity CANVAS for pen testing then for the same reasons I would recommend Python as CANVAS is written in python. Also allot of fuzzing frameworks like Peach and Sulley are written in Python.
I would not recommend Perl as you will find very little tools/scripts/frameworks related to pen testing/fuzzing/exploits/... in Perl.
As your question is "tool writing and exploit development" I would recommend Ruby if you choose Metasploit or python if you choose CANVAS.
hope that helps :)
Speaking as a CEH, learn the CEH material first. This will expose you to a variety of tools and platforms used to mount various kinds of attacks. Once you understand your target well, look into the capabilities of the tools and platforms already available (the previously mentioned metasploit framework is very thorough and robust). How can they be extended to meet your needs? Once you know that, you can compare the capabilities of the languages.
I would also recommend taking a look at the tools available on the BackTrack distro.
All of them should be sufficient for that. Unless you need some library that is only available in one language, I'd let personal preference guide me.
If you're looking for a scripting language that will play well with Java, you might want to look at Groovy. It has the flexibility and power of Perl (closures, built in regexes, associative arrays on every corner) but you can access Java code from it thus you have access to a huge number of libraries, and in particular the rest of the system you're developing.
metasploit is a great framework for penetration testing. It's mainly written in Ruby, so if you know that language well, maybe you can hook in there. However, to use metasploit, you don't need to know any language at all.
If you are interested in CEH, I'd take a look at Grey Hat Python. It shows some stuff that is pretty interesting and related.
That being said, any language should be fine.
Well, what kind of exploits are you thinking about? If you want to write something that needs low level stuff (ptrace, raw sockets, etc.) then you'll need to learn C. But both Perl and Python can be used. The real question is which one suits your style more?
As for toolmaking, Perl has good string-processing abilities, is closer to the system, has good support, but IMHO it's very confusing. I prefer Python: it's a clean, easy to use, easy to learn language with good support (complete language/lib reference, 3rd party libs, etc.). And it's (strictly IMHO) cool.
I'm with tqbf. I've worked with Python and Ruby. Currently I'm working with JRuby. It has all the power of Ruby with access to the Java libraries so if there is something you absolutely need a low-level language to solve you can do so with a high-level language. So far I haven't needed to really use much Java as Ruby has had the ability to do everything I've needed as an API tester.

Is Python good for big software projects (not web based)? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Right now I'm developing mostly in C/C++, but I wrote some small utilities in Python to automatize some tasks and I really love it as language (especially the productivity).
Except for the performances (a problem that could be sometimes solved thanks to the ease of interfacing Python with C modules), do you think it is proper for production use in the development of stand-alone complex applications (think for example to a word processor or a graphic tool)?
What IDE would you suggest? The IDLE provided with Python is not enough even for small projects in my opinion.
We've used IronPython to build our flagship spreadsheet application (40kloc production code - and it's Python, which IMO means loc per feature is low) at Resolver Systems, so I'd definitely say it's ready for production use of complex apps.
There are two ways in which this might not be a useful answer to you :-)
We're using IronPython, not the more usual CPython. This gives us the huge advantage of being able to use .NET class libraries. I may be setting myself up for flaming here, but I would say that I've never really seen a CPython application that looked "professional" - so having access to the WinForms widget set was a huge win for us. IronPython also gives us the advantage of being able to easily drop into C# if we need a performance boost. (Though to be honest we have never needed to do that. All of our performance problems to date have been because we chose dumb algorithms rather than because the language was slow.) Using C# from IP is much easier than writing a C Extension for CPython.
We're an Extreme Programming shop, so we write tests before we write code. I would not write production code in a dynamic language without writing the tests first; the lack of a compile step needs to be covered by something, and as other people have pointed out, refactoring without it can be tough. (Greg Hewgill's answer suggests he's had the same problem. On the other hand, I don't think I would write - or especially refactor - production code in any language these days without writing the tests first - but YMMV.)
Re: the IDE - we've been pretty much fine with each person using their favourite text editor; if you prefer something a bit more heavyweight then WingIDE is pretty well-regarded.
You'll find mostly two answers to that – the religous one (Yes! Of course! It's the best language ever!) and the other religious one (you gotta be kidding me! Python? No... it's not mature enough). I will maybe skip the last religion (Python?! Use Ruby!). The truth, as always, is far from obvious.
Pros: it's easy, readable, batteries included, has lots of good libraries for pretty much everything. It's expressive and dynamic typing makes it more concise in many cases.
Cons: as a dynamic language, has way worse IDE support (proper syntax completion requires static typing, whether explicit in Java or inferred in SML), its object system is far from perfect (interfaces, anyone?) and it is easy to end up with messy code that has methods returning either int or boolean or object or some sort under unknown circumstances.
My take – I love Python for scripting, automation, tiny webapps and other simple well defined tasks. In my opinion it is by far the best dynamic language on the planet. That said, I would never use it any dynamically typed language to develop an application of substantial size.
Say – it would be fine to use it for Stack Overflow, which has three developers and I guess no more than 30k lines of code. For bigger things – first your development would be super fast, and then once team and codebase grow things are slowing down more than they would with Java or C#. You need to offset lack of compilation time checks by writing more unittests, refactorings get harder cause you never know what your refacoring broke until you run all tests or even the whole big app, etc.
Now – decide on how big your team is going to be and how big the app is supposed to be once it is done. If you have 5 or less people and the target size is roughly Stack Overflow, go ahead, write in Python. You will finish in no time and be happy with good codebase. But if you want to write second Google or Yahoo, you will be much better with C# or Java.
Side-note on C/C++ you have mentioned: if you are not writing performance critical software (say massive parallel raytracer that will run for three months rendering a film) or a very mission critical system (say Mars lander that will fly three years straight and has only one chance to land right or you lose $400mln) do not use it. For web apps, most desktop apps, most apps in general it is not a good choice. You will die debugging pointers and memory allocation in complex business logic.
In my opinion python is more than ready for developing complex applications. I see pythons strength more on the server side than writing graphical clients. But have a look at http://www.resolversystems.com/. They develop a whole spreadsheet in python using the .net ironpython port.
If you are familiar with eclipse have a look at pydev which provides auto-completion and debugging support for python with all the other eclipse goodies like svn support. The guy developing it has just been bought by aptana, so this will be solid choice for the future.
#Marcin
Cons: as a dynamic language, has way
worse IDE support (proper syntax
completion requires static typing,
whether explicit in Java or inferred
in SML),
You are right, that static analysis may not provide full syntax completion for dynamic languages, but I thing pydev gets the job done very well. Further more I have a different development style when programming python. I have always an ipython session open and with one F5 I do not only get the perfect completion from ipython, but object introspection and manipulation as well.
But if you want to write second Google
or Yahoo, you will be much better with
C# or Java.
Google just rewrote jaiku to work on top of App Engine, all in python. And as far as I know they use a lot of python inside google too.
I really like python, it's usually my language of choice these days for small (non-gui) stuff that I do on my own.
However, for some larger Python projects I've tackled, I'm finding that it's not quite the same as programming in say, C++. I was working on a language parser, and needed to represent an AST in Python. This is certainly within the scope of what Python can do, but I had a bit of trouble with some refactoring. I was changing the representation of my AST and changing methods and classes around a lot, and I found I missed the strong typing that would be available to me in a C++ solution. Python's duck typing was almost too flexible and I found myself adding a lot of assert code to try to check my types as the program ran. And then I couldn't really be sure that everything was properly typed unless I had 100% code coverage testing (which I didn't at the time).
Actually, that's another thing that I miss sometimes. It's possible to write syntactically correct code in Python that simply won't run. The compiler is incapable of telling you about it until it actually executes the code, so in infrequently-used code paths such as error handlers you can easily have unseen bugs lurking around. Even code that's as simple as printing an error message with a % format string can fail at runtime because of mismatched types.
I haven't used Python for any GUI stuff so I can't comment on that aspect.
Python is considered (among Python programmers :) to be a great language for rapid prototyping. There's not a lot of extraneous syntax getting in the way of your thought processes, so most of the work you do tends to go into the code. (There's far less idioms required to be involved in writing good Python code than in writing good C++.)
Given this, most Python (CPython) programmers ascribe to the "premature optimization is the root of all evil" philosophy. By writing high-level (and significantly slower) Python code, one can optimize the bottlenecks out using C/C++ bindings when your application is nearing completion. At this point it becomes more clear what your processor-intensive algorithms are through proper profiling. This way, you write most of the code in a very readable and maintainable manner while allowing for speedups down the road. You'll see several Python library modules written in C for this very reason.
Most graphics libraries in Python (i.e. wxPython) are just Python wrappers around C++ libraries anyway, so you're pretty much writing to a C++ backend.
To address your IDE question, SPE (Stani's Python Editor) is a good IDE that I've used and Eclipse with PyDev gets the job done as well. Both are OSS, so they're free to try!
[Edit] #Marcin: Have you had experience writing > 30k LOC in Python? It's also funny that you should mention Google's scalability concerns, since they're Python's biggest supporters! Also a small organization called NASA also uses Python frequently ;) see "One coder and 17,000 Lines of Code Later".
Nothing to add to the other answers, besides that if you choose python you must use something like pylint which nobody mentioned so far.
One way to judge what python is used for is to look at what products use python at the moment. This wikipedia page has a long list including various web frameworks, content management systems, version control systems, desktop apps and IDEs.
As it says here - "Some of the largest projects that use Python are the Zope application server, YouTube, and the original BitTorrent client. Large organizations that make use of Python include Google, Yahoo!, CERN and NASA. ITA uses Python for some of its components."
So in short, yes, it is "proper for production use in the development of stand-alone complex applications". So are many other languages, with various pros and cons. Which is the best language for your particular use case is too subjective to answer, so I won't try, but often the answer will be "the one your developers know best".
Refactoring is inevitable on larger codebases and the lack of static typing makes this much harder in python than in statically typed languages.
And as far as I know they use a lot of python inside google too.
Well i'd hope so, the maker of python still works at google if i'm not mistaken?
As for the use of Python, i think it's a great language for stand-alone apps. It's heavily used in a lot of Linux programs, and there are a few nice widget sets out there to aid in the development of GUI's.
Python is a delight to use. I use it routinely and also write a lot of code for work in C#. There are two drawbacks to writing UI code in Python. one is that there is not a single ui framework that is accepted by the majority of the community. when you write in c# the .NET runtime and class libraries are all meant to work together. With Python every UI library has at's own semantics which are often at odds with the pythonic mindset in which you are trying to write your program. I am not blaming the library writers. I've tried several libraries (wxwidgets, PythonWin[Wrapper around MFC], Tkinter), When doing so I often felt that I was writing code in a language other than Python (despite the fact that it was python) because the libraries aren't exactly pythonic they are a port from another language be it c, c++, tk.
So for me I will write UI code in .NET (for me C#) because of the IDE & the consistency of the libraries. But when I can I will write business logic in python because it is more clear and more fun.
I know I'm probably stating the obvious, but don't forget that the quality of the development team and their familiarity with the technology will have a major impact on your ability to deliver.
If you have a strong team, then it's probably not an issue if they're familiar. But if you have people who are more 9 to 5'rs who aren't familiar with the technology, they will need more support and you'd need to make a call if the productivity gains are worth whatever the cost of that support is.
I had only one python experience, my trash-cli project.
I know that probably some or all problems depends of my inexperience with python.
I found frustrating these things:
the difficult of finding a good IDE for free
the limited support to automatic refactoring
Moreover:
the need of introduce two level of grouping packages and modules confuses me.
it seems to me that there is not a widely adopted code naming convention
it seems to me that there are some standard library APIs docs that are incomplete
the fact that some standard libraries are not fully object oriented annoys me
Although some python coders tell me that they does not have these problems, or they say these are not problems.
Try Django or Pylons, write a simple app with both of them and then decide which one suits you best. There are others (like Turbogears or Werkzeug) but those are the most used.

Categories