Jacob Kaplan-Moss wrote:
> * The fact that the returned URL is a string often means I end up
> doing something like `obj.get_absolute_url().split('/')`. Objects are
> better.

I kind of disagree with the last sentence here. An object in place of a 
well-known native type (here, str) adds another abstraction to grok for 
a newbie. It's like when you read WinAPI docs and see a function 
accepting structs of structs of structs and changing some memory buffer 
but you only have a string and want to get an int. I mean it boils down 
to it anyway, just not obvious from the start...

In the rare cases when I do need to split a URL into parts I just use 
urlsplit:

     schema, domain, path, query, fragment = urlsplit(obj.url())

I believe it's a well-known pattern for an experienced pythoneer.

So I'm against of introducing a new Django-specific way of doing 
urlsplit that has chances to confuse both newbies and gurus for 
different reasons.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to