3 ms·
I didn't say I liked anything in Perl better than Python. There may be a couple of things, but it would just boil down to personal taste. Conversely, I like Py
by DavidMcLaughlin 18y ago
I didn't say I liked anything in Perl better than Python. There may be a couple of things, but it would just boil down to personal taste.
Conversely, I like Python better than Perl in two major departments though:
1) The way you import stuff in Python. If you have a long namespace in Perl you have to type it out every time you instantiate an object. Example:
use Organisation::Project::App::Models::Feature;
my $feature = Organisation::Project::App::Models::Feature->new();
In Python you would do:
from organisation.project.app.models import feature;
feat = feature();
It's a small point, but when you have multiple views/actions inside a controller that all use the same model you start to get annoyed typing that namespace in Perl.
2) The native OOP system in Python is much easier than Perl. With Moose this is far less important than it used to be, but comparing core Perl to core Python it is an issue.
- draegtun 18y agoYes its seems common for Perl libraries in commercial environments to get very long and come a right PITA ;-( However check out the excellent "aliased" module... http://search.cpan.org/dist/aliased/ http://search.cpan.org/dist/aliased/ From its POD... use aliased 'My::Company::Namespace::Customer'; my $cust = Customer->new; use aliased 'My::Company::Namespace::Preferred::Customer' => 'Preferred'; my $pref = Preferred->new;
- DavidMcLaughlin 18y agoCPAN strikes again, I was actually hoping someone would show me a better way when I posted that. So thanks!