[Chicago] constant length string manipulation

Jon Sudlow jsudlow at gmail.com
Fri Nov 30 20:28:37 CET 2007


I really enjoyed Chris's Response.

On Nov 30, 2007 9:52 AM, Chris McAvoy <chris.mcavoy at gmail.com> wrote:

> On Nov 29, 2007 3:21 PM, Lukasz Szybalski <szybalski at gmail.com> wrote:
> > On Nov 29, 2007 3:06 PM, Lukasz Szybalski <szybalski at gmail.com> wrote:
> > > Hello,
> > > Is there a string function in python that does the following:
> > > I need a string of length 5 char, and I will pass a longer and shorter
> > > string but I always need to get string of length 5.
> > > If my string is longer its easy:
>
> This task is stupid.
>
> You should only address the "string is longer" issue, use cut (see
> 'man cut' if you need help), and then tell whomever is asking you to
> do this that it can't be done.
>
> (wipes hands, beams triumphantly)
>
> I win.
>
> Otherwise, if they insist that the "edge case" of a string shorter
> than five characters needs to be lengthened (do those even exist???)
> insist that their inflexibility is hurting the agility of your team,
> and demand that they find budget to hire an intern.  Also, pad your
> estimate with acronyms, like TDD and BUTT.
>
> If they continue to give you flak, cough and say "anassholesayswhat."
> When they say, "what?"  Laugh.
>
> Maybe try writing this in Rails.  I'm pretty sure they have a template
> tag that says ""some string of unfathomable
>
> length".shorten_this_if_its_greater_than_five_characters_but_if_its_less_make_it_longer
>  Notice that you don't have to import that (agile!) and you don't have
> to use parens (agile!).
>
> If they won't let you write it in Rails, quit.
>
> Maybe Erlang can handle this?  I'm pretty sure conditional lengthening
> / shortening of strings is something that Functional languages do
> better than procedural languages.  Paul Graham wrote an article about
> it in 1992, right before he created Ebay in Lisp.
>
> Do you use a Mac?  You should.  Because the Mac takes care of Strings.
>  Automagically.
>
> Chris
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>



-- 
Jon Sudlow
3225 Foster Avenue
221 Sohlberg Hall
C.P.O 2224
Chicago, Il  60625
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/chicago/attachments/20071130/c2d201f2/attachment.htm 


More information about the Chicago mailing list