nav search
Data Center Software Security Transformation DevOps Business Personal Tech Science Emergent Tech Bootnotes BOFH

back to article
Everyone loves programming in Python! You disagree? But it's the fastest growing, says Stack Overflow

More people asking questions on Stackoverlfow is not necessarily a good thing; perhaps that means that it's too complicated for people to use in practice,

29
5

Also, not every language community needs/wants Stack Overflow. Reading through the blog post this is a pretty successful press release by SO, not a meaningful exercise in statistics.

(I like SO as much as the next developer because there are a lot of extremely useful answers on the site, but it does seem to me that 90% of the questions asked are by very junior people hacking away in their spare time; as such, Python might receive- probably deserved - laurels as a widespread beginner language; it doesn't say a lot about the industry, though)

18
0
Anonymous Coward

Isn't this backwards?

Stack Overflow's metric here is visits to website posts tagged "Python" compared to posts tagged with other programming languages – specifically JavaScript, Java, C#, C++ and PHP.

I would read this as an indication that the language is simply being used for purposes it is not a good fit, and by people who think they can wield it without learning it first.

A little bit like that apocryphal guy who tried to write a visual text editor in FORTRAN-77, then switched to COBOL in frustration when it didn't work.

12
0

Python is a newbie language pushed as a good introduction to programming, of course there are going to be lots of questions...

Personally I think you would have to be bonkers to use python as a first path into programming, as it's totally at odds with real languages and what the real world uses..

9
33
Bronze badge

While I have only ever used Python on the rare occasions where it's all I had available (labs on VPN connected systems) and I honestly have little love for language-of-the-month, I don't necessarily agree.

I have seen some great Python code written by great programmers... once in a very rare while. In some cases, this is true of the Open Stack project.

On the other hand, Python gains most of it's power from community contributed modules. As such, it, like PERL, PHP and Ruby before it have libraries for nearly everything. Unfortunately, most are implemented by "newbie programmers" building bits and bobs they need.

This results in about a million absolutely horrifying modules. We see the same happening to Node as well. Consider that Node has probably 40 different libraries in NPM to simply make a synchronous REST call. This makes the platform unusable in production code. When a language has a repository of so many poorly written modules that it is no longer possible to sort through them to find one that works, it becomes almost unusable.

See C++... I use Qt because it provides a high quality set of classes for everything from graphics to collections. The standard C++ library and heaven forbid boost are such a wreck that they have rendered C++ all but unusable.

See Java where even good intentions go horribly wrong. Java on the desktop was absolutely unusually for apps because there were simply too many reboots of the GUI toolkit. AWT was so bad that IBM OTI made SWT and Sun made a bigger mess trying to reboot their dominance with SWING and Google made their own... well let's just say that it didn't work.

I can go on... there should always be a beginner language for people to learn on and then enventually trash. Python is great for now. Maybe there will be something better later. Learning languages should be playgrounds where inexperienced developers can sew their oats before moving on. Cisco for example pushes Python and Ansible to network engineers who learn to code in 8 hours. Imagine if every network engineer or VMware engineer were to start destroying other languages? That would be a million people who have never read a programming book trashing those other languages' ecosystems.

20
0
Gold badge

"perhaps that means that it's too complicated"

Ease of programming is not necessarily a good thing.

When engineering a physical object you have to pay attention to tolerances. For simple objects, or with very clever engineering, those tolerances might be fairly generous. For the most complicated objects, the tolerances will usually vary from one part of the object to another but will often be very tight in the critical areas.

In programming, sometimes it is really important that you say exactly what you mean and definitely do not say anything that you don't mean. That's like an intelectual tolerance. Some languages are fairly relaxed and will execute almost anything you can type and will attempt to "do the right thing" based on heuristics. Others are fascist straight-jackets that demand bowing and scraping in the appropriate places, but which can then be trusted to do exactly and only what you have (finally) specified.

Obviously it is possible to have the worst of both worlds, with fascist syntax and DWIM semantics. However, I doubt it is possible to have the best of both worlds. At some point, you have to knuckle down and get particular.

9
1
Anonymous Coward

"[...] where inexperienced developers can sew their oats before moving on. "

Vasectomy clinic: A stitch in time saves nine.

9
0
K
Silver badge

@Dr Mantis Toboggan

Let me guess, you just graduated? Now go make the tea little padawan!

There are 2 things you need to learn, and quickly:

1) There is no "beginner languages" or "real languages", each language has it uses and its a case of choosing the best for the intended purpose.

2) Elitest (aka newbie) developers who scream "my language is better", typically lack the skill, confidence or dexterity to recognise this, then often leave a mess when they depart as they lacked the insight to recognise point 1.

Broaden your skillset and widen your appeal (as well as salary), or forever be working on the same shit day after day, then when your "real language" goes out of vogue, start panicking that there are insufficient roles and two many "Elite developers" fighting for them.

31
3
Silver badge

> it's totally at odds with real languages and what the real world uses..

The "real world" is increasingly using Python.

15
1
Silver badge
Boffin

Extinct

Wow. A lot of elitist dinosaurs evident in these comments.

Python is a nice, clean language that extends to being really powerful when you need it. I've written in more computer languages than I can rightly remember, and there's a lot in Python that made me grin when I encountered it. Because it was almost always a tidy solution to the problem.

And now that it looks like they've finally put Python 2 to bed, I see no stopping Python 3's progress. The reliance on whitespace formatting is unusual at first, but once you learn how it works, it makes complete sense and ensures well presented code that doesn't look like shit.

I realise that some take pride in their code being dense and incomprehensible, but that doesn't impress me. Let them maintain their sniffy aloofness about Python not being a language for real programmers if they wish. But coders of the next decade will be in employment using it.

14
3
Silver badge
Headmaster

Re: Extinct

"Python is a nice, clean language..."

Well, not really that clean.

b = [1,2,3]

a = b

a[1] = 9

b[1] = 10

What is the value of a[1]?

All the same, I like Python and a lot of production software is written in Python these days.

9
2
Silver badge
Holmes

Yeah the flaw in logic is extreme, it means you have loads of people turning up asking for help might well be a stunning indictment of the language. It might just well be an indictment of the only way people feel they can get the help they need is to show up and repeatedly ask the same silly questions on SO.

Or it could just be related to popularity of the language or related to the kinds of people using it and the problems people are trying to solve with it. The reality is it doesn't really tell anybody anything.

Nice to see the defensive posts by people who obviously ask a lot of python questions on SO though heh.

2
4

Too many competing libraries

I have noticed the same thing as CheesyTheClown. Namely, that open source is both good and bad. It's good that the source code is available to everything and it's good that it is open for everyone to contribute, but, I think this can be a drawback as well when there are too many competing ways to do things. This is what I hate about Java. Every developer has their own preferred libraries for doing this and that. I would rather just have one library for doing a given thing. One that is robust and works well and that everyone is using. I think this is what I actually hate the most about Java. For any given project, there is always someone using some old crapping library like Struts that should have died a long time ago. Or, you have 15 different ways of doing logging. It is ridiculous. No one just does things using Java EE. Also, I cannot stand frameworks like Spring and it's reflection hell. I honestly don't see how what it does is supposed to be good. It is totally out of hand. Historically, I have preferred .NET over Java for exactly this reason. You install .NET Framework and Visual Studio and you are basically set at that point. No Maven hell. However, now Microsoft has decided to parrot the cool kids, first by parroting Ruby On Rails with ASP.NET MVC and now with .NET Core and NuGet. Modularized isn't necessarily better IMHO. I am fine having things by somewhat monolithic if it means that I am able to implement an application from end to end in a simplified manner. That is not how things are trending. So, as far as I'm concerned the new cool way of doing things by cobbling an app together using 15 different libraries from all across the Internet isn't the superior way of doing things.

9
0
Anonymous Coward

Re: Extinct

@Yes Me - what lack of cleanliness are you trying to point out here?

2
1

Re: Extinct

what lack of cleanliness are you trying to point out here?

Heh, if anything it's too clean.

0
0

Worked in real world engineering for 25 years, C, CPP, .Net, Java and other real languages. Python doesn't really fit or have much in the way of use there, and it's a poor choice to learn, as real languages are so far away from these noddy languages like python.

2
16
Anonymous Coward

Please cite,. The real world seems to be C, CPP, .net and Java.

0
3
Silver badge
Devil

Re: Isn't this backwards?

"I would read this as an indication that the language is simply being used for purposes it is not a good fit, and by people who think they can wield it without learning it first."

that's a distinct possibility. I only hit 'Stack Overflow' when I'm trying to get past a particular problem without spending WAY too much time "learning" - I'd rather be SOLVING, thanks. And that's the point. To me Python is "yet another lingo" that I have to deal with because "customer decided" so there you go.

And given my experience with fixing existing python code, which looks like it was written by undergraduate students that learned to code in JAVA first, or worse, C-pound... given my experience with having to fix THAT code, I end up just writing an external C program to do the REAL work, then hit the search engines looking for "how do I run an external program from within python and return the result code and/or stdout back". And then I find out the magic code lines, and "make it so".

And _EVERYTHING_ _RUNS_ _BETTER_ _AFTERWARDS_! [amazing, right?]

But yeah, hacking out a working solution, especially without "paying the dues" with all of that UNNNECESSARY reading of documentation (from beginning to end) first, is what us hacker problem solvers do best.

yeah, the world really IS "results driven"

But as for using Python, it has its uses most certainly, but is _FAR_ from being a "panacea language" especially because it is SO inefficient for SO many things... [30 times faster when done in C in one specific case].

1
4
Silver badge
Childcatcher

Re: Extinct

"A lot of elitist dinosaurs evident in these comments"

get off my lawn, you young whippersnapper! [heh]

Seriously, don't use an interpretive programming language for ANYTHING that requires performance, especially one that has built-in garbage collection and "duck typing", regardless of whether it does 'just in time compiling to pseudo-code' or not.

And more often than not, "object oriented" is _HIGHLY_ overrated [especially when it comes to system performance]. This goes TRIPLE for VMs and shared hosting... "oh but it doesn't matter because CPUs are so fast these days, and memory so cheap" until you try and run a bunch o' stuff simultaneously in multiple VMs or shared hosts, and then you find out what kind of impact inefficient code has. Yeah.

I wouldn't write a massive system in Python. I'm having to FIX one, at the moment (uses Django) and it's seriously in need of a MASSIVE re-write. Fortunately, I quickly figured out how to invoke an external program [written in C], and that solved MOST of the performance issues.

Yeah, I _do_ keep saying that about Python invoking a C program. It _is_ 30 times faster this way, with that one specific example. And it makes a very valid point that I want to express to as many people as possible: Do NOT attempt to force Python into a 'C' shaped hole. You'll go bat-guano insane trying. Use a language that's more suited to the task, and Python as the glue if you want to [for which it works very, very well, in my opinion].

but writing a massive system in Python? I'm old enough to remember how *CRAPPY* RSTS/E was, and it was written in COMPILED BASIC. So, "NO" to 'massive system in Python'. That is, if you want PERFORMANCE out of it.

'children' icon because, youngins these days...

5
5
Silver badge
Devil

Re: Too many competing libraries

"as far as I'm concerned the new cool way of doing things by cobbling an app together using 15 different libraries from all across the Internet isn't the superior way of doing things."

I made a similar *kind* of point back in the 90's, regarding Visual Basic, and "cobbling together" an application by using VB with a bunch of plugins, modules, 3rd party components/libraries, etc..

And at the same time, rather than mangling my perfectly good C++ code to work with some 3rd party graphics library, I wrote some simple Windows GDI-based algorithms to create 3D looking bars and "did it right" so my bars looked better than their bars in a side by side comparison. And it took less time. yeah, so much for 3rd party library "make it fit" and having to pay a license fee...

[and I'd thumb-up your post except you said favorable things about ".Not" - ".Not" was one of the biggest reasons I shifted away from windows coding]

1
4
Anonymous Coward

Re: Extinct

might be popular and trendy, but it's shit.

and the white space stuff is fucking stupid, whoever thought that was a good idea is an idiot.

6
1
Silver badge

Re: Extinct

> Well, not really that clean.

> b = [1,2,3]

> a = b

> a[1] = 9

> b[1] = 10

How is that different from other languages ?

int a[3] = {1,2,3};

int * b = a;

a[1] = 9;

b[1] = 10;

5
0

Re: Extinct

You're explicitly creating a pointer to the object, it's clear what you're doing. Say you were using the C++ STL, you could create a vector with a copy of another vector explicitly. But in Python it's not particularly clear that what you're doing here is assigning an object reference so a and b apply to the same object (yes, once you're familiar with Python this is less surprising). And indeed the ways of actually copying an array are all a bit weird.

3
0
Silver badge

In the science / datascience field

Python is finally beginning to recover from the 2.x / 3.x schism, as more and more libraries get ported to 3.x which makes it trivial to port end-user applications. Yes, you got it right, a whole lot of core scientific library are just beginning to hit the 3.x repos. That sure made things difficult for science Python users, especially on Windows (ptouach') which lacks any kind of centralized package management (from the end user point of view at least) and meant either a lot of fiddling or the use of CygWin. Not terribly difficult, but an added barrier to adoption and growth nonetheless.

0
0
Anonymous Coward

... C, CPP, .Net, Java and other real languages...

Out of interest, why is Python not 'real'. What does make a 'real' language? Or should I just stop feeding the troll?

5
0

"Do NOT attempt to force Python into a 'C' shaped hole"

Completely agree

I think Python is a great language, but C/C++ for the performance elements.

Python as the Glue to hold together the compiled C libraries is a great analogy, I like it!

1
0
Silver badge

Re: Extinct

Well, not really that clean.

b = [1,2,3]

a = b

[ ... complaining about assignment by ref ... ]

That's clean. Everything is assigned by reference. It's working out how "x += 1" works that's a little different.

0
0
Silver badge

Re: Extinct

"(yes, once you're familiar with Python this is less surprising)."

I'm more surprised when languages don't do that. Javascript and lua both do it, and PHP and perl quickly grew the ability to do it.

It's not just the performance -- references are a fundamental part of programming data structures and I can count on the fingers of one hand the number of times I've wanted to create a copy of an array (and all its subobjects, and all their subobjects...)

0
0
Silver badge

Re: Isn't this backwards?

"And given my experience with fixing existing python code, [etc.]"

Well, based on my long-ago experience as a copy editor, English is a pretty terrible language.

3
0

Re: Too many competing libraries

I agree with regard to simply writing code yourself in some cases. IMHO people are too dependent on "code reuse" and think they need to use a third party library for everything. I would rather write a few lines of code than pull in a huge library to do something simple. It is true that one shouldn't reinvent the wheel in general, but, I sometimes wonder if people even know how to code since they seem so obsessed with adding packages to a project.

0
0
Silver badge

Re: Extinct

> But in Python it's not particularly clear that what you're doing here is assigning an object reference so a and b apply to the same object (yes, once you're familiar with Python this is less surprising).

It has always been very clearly stated that is what happens and was always obvious to me.

> And indeed the ways of actually copying an array are all a bit weird.

a = copy(b), how weird is that ?

or you can create a new list from the existing list with list()

>>> a = [1,2,3]

>>> b = list(a)

>>> b[0] =9

>>> a

[1, 2, 3]

>>> b

[9, 2, 3]

Of course references to complex objects within the list are copied as another reference to the same object, deepcopy() creates copies of the objects too.

I don't know why you think any of this is "weird", it is just like other programming languages.

1
0
Silver badge

Re: Extinct

99% of programmers, when they see this:

a[1] = 9

b[1] = 10

What is the value of a[1]?

would answer "9". In the example I gave, the correct answer is "10", because the previous statement a = b simply gives the array "b" an additional name "a". That may be logical within Pythonia but when you have to debug it, it's hardly clean.

0
0
Silver badge

Re: Extinct

The difference is that little star in 'int * b = a' and the fact that that statement is clearly a declaration of a pointer.

In Python, if you write a = b and they are both integers you get a new variable a with the same value as b. If you write a = b and they are both compound objects, you get a new name for object b. That's a dramatically hard bug to find in a large program that relies in any way on dynamic typing. And it's not going to happen in C because (a) you have to declare and type your variables explicitly and (b) that * tells you it's a reference, not a value.

1
0
Silver badge

Re: Extinct

"Everything is assigned by reference"

True. But

x=1

y=x

assigns a reference to the constant "1" to y, so this behaves like an assignment in every other language I've ever seen. Whereas if x is (the name of) a compound object you get a reference to the object. If that's not what you want, you have to use copy or deepcopy or whatever.

I have no intellectual difficulty understanding this. But it really is a trap for the unwary.

2
0
Silver badge

Re: Extinct

> In Python, if you write a = b and they are both integers you get a new variable a with the same value as b. If you write a = b and they are both compound objects, you get a new name for object b.

No, you are wrong. In Python 'b = 1' makes 'b' a reference to a PyIntObject that has ob_ival of 1. 'a = b' gives a new name to object 'b'. This is exactly the same as if they are any other type of object except that a number of int objects are precreated by the run time for performance reasons. So 'b = 1010' does create a new object but 'b = 1' does not.

> That's a dramatically hard bug to find in a large program that relies in any way on dynamic typing. And it's not going to happen in C because (a) you have to declare and type your variables explicitly and (b) that * tells you it's a reference, not a value.

No. In Python _everything_ is an object. There is no requirement to "tell you it's a reference, not a value" because there are no values.

https://www.laurentluce.com/posts/python-integer-objects-implementation/

0
0
Silver badge
Thumb Up

The Right Tool for a Lot of Jobs

Python is growing fast mainly because it is heavily used in a lot of fast growing fields, including web applications, high performance computing, analysing big data sets, machine learning, system management, etc., etc About the only popular area it doesn't cover well is mobile client apps.

A lot of these fields have communities which have coalesced around open source libraries which implement the critical functions of that field. And one thing that Python does really, really, well, is let people wrap libraries written in other languages and interface them to Python. If there is an existing library written in C, Fortran, assembly language, or just about any other statically compiled language, you can probably interface it to Python without too much trouble and with little run-time overhead. Python doesn't force you to re-implement everything in itself in order to be able to use it like some other languages do.

CPython's single execution thread and reference counting memory management are big strengths here, because they don't force those other languages to conform to a specific threading or memory management model. This is why CPython is overwhelmingly the most widely used version, while the Python versions which incorporated JITs and eliminated their GIL struggle with a lack of library support.

The big advantage that Python has over languages like Matlab is that there are loads of libraries to do all the data handling and display that makes up the bulk of most programs. Just about everything you need to do already has an open source library to do it.

One common theme in a lot of these applications is that the software designers tend to think in terms of using multiple racks of hardware rather than just multiple cores. Multi-processing is another area where Python excels, with many good solutions, including in the standard library.

Python's weakest point is probably in the GUI space. It's not that there's a lack of GUI options, it's that there's so many that there has been no tendency to standardise on one widely used option. TkInter comes with the standard library, but it's limited and the out of the box theme lacks visual appeal. QT is great, but installation is a bit of a pain unless you are running Linux (and let the distro package manager handle everything seamlessly). Pygame is game oriented. Kivy focuses on mobile and isn't meant for desktop platforms. Etc., etc.

Overall though Python is well established on the server, and is particularly good at allowing developers to get the job done in fewer man hours than many of the alternatives, and so at lower cost. That has fit many of the fastest growing trends in the modern IT industry, and so accounts for the rapid growth. Python has actually been around longer than Java, but it has received so much attention now because it fits the current market.

On the other hand most Python developers will also tell you that there is no one size fits all when it comes to computer languages. Python is good for some jobs, while C is better for others, and Javascript is pretty much the only realistic option for web browsers.

In my opinion where the big problems tend to arise in software development is with people who only want to learn one language and then spend the rest of their careers attempting to pound square pegs into round holes. I've learned many computing languages over the years, and I don't believe in getting too attached to any one. Right now though, Python ticks a lot of the right boxes for most of what I need to do.

30
0
Anonymous Coward

Re: The Right Tool for a Lot of Jobs

@thames

Good comment. I'm not sure about the observation that "Python's weakest point is probably in the GUI space." Much depends on individual taste for the look and feel of the resulting UI. Personally, I'm indifferent, so tkinter works fine for me, even though the result is pages and pages of VERY similar looking code! Much better (for me) is to use glade as a wrapper for GTK....less code plus the advantage of a GUI designer. No doubt others will have different views!

0
0
Silver badge
Happy

Re: The Right Tool for a Lot of Jobs

"And one thing that Python does really, really, well, is let people wrap libraries written in other languages and interface them to Python. If there is an existing library written in C, Fortran, assembly language, or just about any other statically compiled language, you can probably interface it to Python without too much trouble and with little run-time overhead."

With memories of how much work can be involved with that in other environments, this is truly useful.

3
0
Silver badge
WTF?

Re: The Right Tool for a Lot of Jobs

"Python is growing fast mainly because it is heavily used in a lot of fast growing fields, including web applications, high performance computing, analysing big data sets, machine learning, system management, etc., etc "

not sure I like where this is going. And not because Python is a BAD language [it is, in fact, a GOOD language]. Python is just NOT SUITED for anything "high performance".

When you use some of those libraries, they're coded VERY inefficiently. There was one specific example I ran into, either in matplotlib or numpy. It was GROSSLY inefficient the way it was implemented. I basically re-wrote code to avoid using it as much as possible, and made a significant speedup just from that. I can't remember what it was (sorry) but I remember doing this. I shaved 15 or 20 seconds off of a file upload operation JUST doing that. Then I shaved OVER A MINUTE off by using the external C program. What WAS taking 2 minutes (or more) is now taking around 10 seconds [because I didn't want to re-write ALL of the python code in C, but if I had, it would probably take less than 2 seconds].

Now, for generating charts, other than matplotlib's hideous API, it's "convenient". Sort of. OK maybe not, and I might have to go to using something else like Cairo but still...

In any case, watch your CPU utilization. If you write Python code and are charged by cloud services for CPU utilization, you'll save a LOT of cash by going wiht a C language utility instead, at least for the parts that do the number crunching, "high performance", etc..

1
4

Re: The Right Tool for a Lot of Jobs

re: not covering mobile client apps

you should look @ kivy which is better than most things out there now

kivy runs on android and apple

0
0
Silver badge

Re: The Right Tool for a Lot of Jobs

@bb: I'd say for doing data analysis you'd want to know 2 languages - Python and R. This has been noted it various "what are you using" polls in the sector. Python give you excellent data munging capabilities but I'd much rather use R with data.table and ggplot2 for slice and dice and charting than the abortion that is matplotlib. Aspiring to MatLab's plotting capabilities is a low bar indeed.

0
0

Re: The Right Tool for a Lot of Jobs

I really do wish there was a better cross-platform GUI option for Python.

0
0

Re: The Right Tool for a Lot of Jobs

ggplot2 is nice for lots of stuff, sometimes a bit hard to persuade it to do exactly what you want (though in those cases you sometimes realise what you want doesn't make sense). Data.table is a big improvement on standard R for performance, and lets you write some things very concisely, but R performance is generally very poor, even compared to other interpreted options like Matlab.

0
0
Silver badge

Re: The Right Tool for a Lot of Jobs

I didn't think wxWindows was bad, and PythonCard made it fairly painless to use. But last I checked (several years ago), PythonCard seemed to be abandoned.

0
0
Silver badge

Re: The Right Tool for a Lot of Jobs

> I really do wish there was a better cross-platform GUI option for Python.

I found Glade/pygtk to be excellent with a designer for the interface that auto links to the code. I still have stuff that use EasyGUI which is really easy for dialog boxes. The real problem is that there are too many really good options.

https://wiki.python.org/moin/GuiProgramming

https://docs.python.org/3/faq/gui.html

https://wiki.python.org/moin/GUI%20Programming%20in%20Python

0
0
Silver badge

Re: The Right Tool for a Lot of Jobs

> When you use some of those libraries, they're coded VERY inefficiently

Not really Python's fault though, is it?

If Python could be blamed at all, it's because it's made it easy for you to use those inefficient libraries. Unlike other languages, which would have made all libraries, including the inefficient ones, difficult to use.

0
0
Silver badge
Thumb Up

Python is far from perfect, but there's a brevity, cleanliness and uniformity to it that's very appealing. There are also powerful and easily available tools (e.g. 'yield' statement) that exist easily within it's simple syntax.

Oceans of libraries are nice too.

16
1
MrT
Silver badge

Back when I was at school, BASIC was the learner's starting point - not perfect, but you've got to start somewhere and variants of that were becoming the default built-in language of the more readily available computers. I preferred Pascal, then Delphi, but I've always recommended folk bet against me if they want guaranteed success... ;-)

These days, there's more choice, but learners still start with one or two from a smallish choice - Python's one of those (we use it on a VM where I teach). That boost could also be down to a rise in Computing Science numbers in schools, as well as coding clubs like CoderDojo and the like. More driven learners ask questions and find things out for themselves, and if that's at SO, then there's another reason...

0
0
Silver badge

Ah, yield... generator functions are great.

A couple of years ago I was trying to do some text generation that included multiple correct solutions. As a total hack, I took my object model and added a toProlog method to each object and yes, seriously, I had part of the code convert everything to Prolog and then ran the search in Sicstus. It was a monumentally crazy hack and led to weeks of debugging. When I later realised that by shoving a yield statement and iterating on all results from the generator functions called from each function, I could do exact same thing in Python much quicker and with far fewer lines of code.

Generator functions are a good example of a core element of the Python design philosophy -- it enables you to work with datasets of virtually unlimited size, producing ad hoc code to process them.

0
0
Silver badge

Usefulness

Python has a couple of traits that make it very useful for those who program as a secondary function. Its syntax is relatively easy to understand, it has a lot of very good libraries available, and being an interpreted language it is easy to experiment with code to see what a fragment will do. Plus, it is not 'teaching' language like Basic or Pascal. It was designed to a general purpose language suitable for a wide range of programming problems.

But like any programming language there are areas that it sucks at.

5
0

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

The Register - Independent news and views for the tech community. Part of Situation Publishing