![]() |
Only in python!
Only in python could I do things like:
:
or :
or even :
I just feel like I am cheating. Yes, the features in python are fantastic, but I somehow get more satisfaction from implementing it myself. Am I the only one? |
Yes and No......... I feel real satisfaction from writing an assembly language program too .... but I would still much rather create projects with C\C+ then that..... and I would much rather create projects with Python then C\C+ for the same reasons..... I still get satisfaction from it....either way,,
|
Its not cheating, these are pythons features man :-)
These are the things that i love about python. But the higher the level of your programming the language, the more cool stuff like this are included. (IME) |
you are not cheating, you can do that too in ruby.
|
>>Master
Does that make it any less.. cheatlike? I don't think it's cheating, or lame; the built-in functions are included for a reason. The reason? To be used. :P This is cheating, in my opinion. |
:
for a, b in dict([(name, age) for name, age in people.items() if age > 15].items():And you think these features are cool and make life too easy? Try reading webpages, writing/reading CSV files, dumping/loading objects from files, and using db files in C++ or C or even PHP or Perl. |
Quote:
Ya, I caught the pointless conversion to a dict and then to a list of tuples. Unfortunately, the edit button dissapeared. There is also an error the second code snippet where I define a kid() function and then call mature() with filter(). The specific examples are really not the point of the thread. |
Quote:
|
It's hardly a case of 'only in Python' - more like 'only in high level languages'. The filter function you like so much is a functional programming feature which Lisp had fifty years ago. And with the right kind of libraries you can do a lot of those things in C++ or Java too.
Using a library isn't cheating if your goal is to write a program to do something which the library would make easier. It's only cheating if your goal is to learn how to write such code and understand how it works yourself. So long as you don't cheat yourself, I wouldn't worry. Or would you rather write everything in machine code? (Not even assembler, I'm talking about using hex code instead of mnemonics like ADD and MOV! :p) |
Quote:
|
| All times are GMT -5. The time now is 8:56 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC