Are Java and C# as "customizable" as Python? -
at time of asking, using python of time, , have not used java or c# much, although have (basic) idea of how work. thinking possibly start use java or c# more, seems little know them aren't "customizable" python, may wrong.
by "customizable" (there better phrases use describe mean, can't think of better :-) ), mean things in python like:
- dynamic object attributes definition (using
__getattr__
, etc.) - import hooks (so code modules can imported type of media, not files match sets of criteria)(see pep 302 -- new import hooks, , this stackoverflow question)
- operator overloading (i think c# , java both have this, example)
- subclassing of built in types
- mappings , sequence simulation using
__getitem__
,__setitem__
, ,__delitem__
, etc., "magic" methods
so, wondering if there (at least of) these "customization" kinds of things in java , c#, , if not, there functionally similar or equivalent ways these kinds of things?
python being dynamic language going have advantage here on more static languages c# , java. java , c# have traditionally targeted more conservative markets, making them more conservative design. although c# gains more , more dynamic oriented features each new release.
dynamic object attributes definition (using __getattr__, etc.)
this can accomplished in c# 4.0 using new dynamic support. idynamicobject
it's possible implement "method_missing" (ala ruby) in c#. doing against language's overall intent , "feel", , i've never seen done in practice (with possible exception of asp.net mvc's viewbag)
operator overloading
c# has operator overloading. in experience never used.
subclassing of built in types
only if type not sealed. if sealed, extension methods trick. many/most built in types in c# sealed.
mappings , sequence simulation using __getitem__, __setitem__, , __delitem__, etc., "magic" methods
implementing ienumerable<t>
best bet in c#. let type hook linq , kinds of goodies "free"
i have little experience python, "dynamic language of choice" has been ruby. i've professionally worked in c# since debuted. c# has come long ways , has grown pretty decent language. have "kitchen sink" feel it, can intimidating @ first. part come well. however, fluidity, flexibility, power , potential abuse ruby has not present in c#. hardcore ruby-ist (and presumably, python-ist) find c# frustrating , limiting. c# still "enterprise" language, , be.
Comments
Post a Comment