New to Python: Features

Richard Blackwood richardblackwood at cloudthunder.com
Tue Oct 5 05:10:39 CEST 2004


Hi, I'm new to Python and I'd like to know if Python has the following 
support: *please answer to each individually, thanks*

1. Multi line comments
2. Functions as variables:
    a. functions can be stored in variables, passed as arguments to 
other functions, and returned as results.
3. Function nesting with proper lexical scope (i.e. closures)
4. Operator overloading (inc. the ability to define new operators)
5. Can I do this?  print("Hello " .. "World")  --> Hello World
6. Constructors
7. "Chunks": as in a code block contained within a string, file, or 
delimited by some sort of notation (such as brackets) which can be 
passed to and from functions, stored in objects, with the option of 
local scoping of variables declared within it.
8. "Repeat-Until" as in :
    repeat
      line = os.read()
    until line ~= ""
    print(line)
9. Generic for loops where " for i=1,f(x) do print(i) end" would print i 
only once.
10. Can I call an object's method as object:method(arg) and have that 
translate into object.method(object, arg)
11. Can I make dynamic statements and nature like with eval() in Javascript?
12. Can I make calls to a function with a varying number of arguments?
13. Named arguments
14. Tables with built-in methods for manipulation such as sort, etc.
15. Table filters
15. Proper Tail Call (otherwise known as Proper Tail Recursion)
16. The ability to call a function without brackets
17. Is the Python interpreter a JIT? Does it have a bytecode?  Is it as 
fast as Java?
18. The ability to modify the import/require functionality (how modules 
can be loaded)
19. Coroutines and threads (non-preemptive)
20. Date persistence and serialization
21. May modules be stored in variables, passed to and produced from 
functions, and so forth?
22. Is the self parameter hidden from me as a programmer?  Can I 
hide/unhide it as I wish?
23. Prototype-based OOP or the ability to extend a class without 
physically modifying it
24. Manual garbage management
25. A fully implemented .NET counterpart (I should be able to write 
Python scripts for both with the same code)
26. How easily can other languages access it and vice versa?
27. The option of mixing in static typing
28. Automatic type coercion
29. Is Python designed in such a way that I may merely "plugin" a 
C/C++/Java/D module which will then allow for mixing their syntax and 
perhaps even access to their facilities within Python?
30. Messaging syntax such as : [myColor setRed:0.0 green:0.5 blue:1.0] 
or [dog bring:paper to:me] and [[myAunt phone] setTo:[myUncle phone]] 
<--- Nested messages and [dog perform:sel_get_uid("bark")] which is the 
same as [dog bark]
31. Concepts of Protocols (whereby one may organize related methods into 
groups and check whether a particular object implements the methods 
within this protocol), or Interfaces similar to those in Java whereby 
classes or objects which implement the interface (sign the contract) 
must implement the methods and attributes as specified in the interface, 
and/or programming by contract such as in Eiffel (see: 
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=595)
32. Support for unplanned reuse of classes such as in TOM 
(http://www.gerbil.org/tom/)
33. Function/Method overloading
34. In pure Python, can I change and add new constructs to the Python 
syntax?
35. May I modify the garbage collector?
36. May I implement control structures as object messages?
37. Dynamic dispatch
38. Reflection and/or templates
39. Unicode
40. Ability to call external APIs and DLLs with relative ease
41. How easy is it to port my Python code to C/C++/C# or Java?
42. The ability to assign a method(s) to a collection/group of objects 
[with a particular signature i.e.]
43. Embedding variables in strings like: print "Hello, World. Time: 
#{Time.now}"
44. Case or Switch statements with functionality as such:
case score
when 0...40
   puts "Horrible!"
when 40...60
   puts "Poor"
when 60...80
   puts "You can do better!"
when 80...95
   puts "Now that's acceptable"
when 95..100
   puts "That the best you can do?  j/k"
else
   puts "Didn't take the test?"
end
45. Are all things objects in Python?  Do all objects have built-in 
iterators and the like?  i.e. can I do this:
    3.times { print "Ho! " }
    puts "Merry Christmas"

That's all folks!





More information about the Python-list mailing list