Before I explain what I mean in the title, I want to say that I
1) Have very little experience with python, so take anything I say with that in mind. I've only read about it, haven't really used it (although I have installed it),
2) I want to learn it, but I feel the approach I've taken thus far has been unsuccessful,

Okay. I've been reading about Python for a while on various websites (including the actual python site) and I feel like I've been having a tough time understanding how the core language is even useful for a regular user "out of the box" so to speak. What I mean by this is that when I've tried to learn about how Python works for the web, I end up just getting sent places like Django.com.

Because I'm familiar with PHP, I'll use it as an example (not a fanboy, I promise I want to learn and use any programming language if it's truly worth it!!). With PHP, creating a Hello World webpage is as simple as a single line, or as complex as a MVC-based framework with an extensive library of additional classes. I'm looking for that starting point with Python, but I feel like every resource I try to find ends up taking me to their "web frameworks". It's cool that there are web frameworks, but how do you make a page using Python without a web framework? Is the process too complex to be worth doing when using just the core library?

So my impression so far with Python on the web is that you need to use a pre-built framework in order to actually utilize it effectively, but none of the frameworks are officially supported as a part of the language, only as third party code. So I thought maybe it'd be worth it for the desktop side, but that too feels like it relies heavily on third party code in order to actually be effective from what I've seen, relying on any number of different development platforms that aren't a part of the actual core files you'd get off the python site.

To give you an idea of where I'm coming from, I've been using PHP5 for a while and I'm about finished with an extensive framework I've been writing from scratch for about 6 months now, start to finish, that utilizes a ton of features similar to CodeIgniter/CakePHP with changes where I felt necessary as well as several more obscure libraries more closely related to online gaming such as ventrilo/wow armory classes. When I started with PHP, it was as simple as <?php print "Hello world"; ?>, to spaghetti code, to functions, to classes, etc. I want to get to that point with Python, but I feel like the jump from just looking at the core options to trying to figure out django's code is a bit steep. I'm sure at some point I'd even probably end up using something like Django, once I fully understand how it works and what its limitations are, but in order to do that I need to know the more basic principles behind how the core language works -- the kind of things that seem sort of obvious with a language like PHP.

I've searched, and read, and browsed for hours trying to really get into this language, and I still want to learn it because so many people seem to recommend it and honestly, I mean, google. Need I say more? So that's where I'm coming from, I really do want to learn the language, and I want my perceptions of Python thus far regarding web/desktop development to be proven fully false so I can embrace some of the core fundamentals that go into development on either platform and go from there.

Thanks in advance for any replies, and I want to state again that I don't intend for this thread to turn into a PHP/Python fanboy thread, I'm just a guy heavily into PHP who's also really interested in getting into Python, so please don't take anything negative from this post as an attack -- I admit I probably don't know what I'm talking about, I just want to make sure. :)

Recommended Answers

All 2 Replies

When I started with PHP, it was as simple as <?php print "Hello world"; ?>

import cgi
print "Content-Type: text/html"
print
print "Hello world"

http://docs.python.org/library/cgi.html


So my impression so far with Python on the web is that you need to use a pre-built framework in order to actually utilize it effectively, but none of the frameworks are officially supported as a part of the language, only as third party code. So I thought maybe it'd be worth it for the desktop side, but that too feels like it relies heavily on third party code in order to actually be effective from what I've seen, relying on any number of different development platforms that aren't a part of the actual core files you'd get off the python site.

Well someone had to write those frameworks in python in the first place so it can be done. Python itself is very small and easy to use, but powerful. You use the same basic language to interface all the various libraries. In other words, if you just learn general python until you're comfortable with the language, you can easily apply that to whatever libraries you need. Relying on external code for specific tasks isn't a bad thing. It means you only download what you're actually going to use. And if the big frameworks are too much you can always write it "from scratch" with lower level libraries.

I suggest learning the basics of Python before trying to use it as a web platform. I highly recommend dive into python, which is a free book online that is geared for programmers that already know the basics of writing code in general (control flow, data structures, etc.)

Python wasn't necessarily tailored to creating webpages, but rather to have the ability to do ANYTHING. It's a scripting language at it's core, and the syntax is designed to read like pseudo code. This makes it extremely easy for a programmer coming in from a new language (or even a complete newbie) to look at example code and instantly understand it.

That's not to say that the language is simplistic, as there are plenty of ways to obfuscate code and make it highly unreadable by combining steps, but the natural and most straight forward way is almost always instantly human-readable.

There's plenty of resources on this site as well. I suggest the sticky thread in this forum that's tailored towards beginners. It has plenty of challenges that will help you get into Python quickly. Also, don't be afraid to ask questions, as there are plenty of Python gurus on this site that are willing to help. Just remember to follow the rules and to use code tags when posting code.

I look forward to seeing you around more often, and (hopefully) being able to answer your questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.