[Chicago] constant length string manipulation
Jeff Hinrichs - DM&T
jeffh at dundeemt.com
Sat Dec 1 05:58:42 CET 2007
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
>
This thread is the closest thing to a monty python skit I've read in a
while, I would have responded earlier but I had to clean the tea off
my desk, which got there when I attempted to take a drink while
reading the last line of Chris' response. Jolly good.
--
Jeff Hinrichs
Dundee Media & Technology, Inc
jeffh at dundeemt.com
402.218.1473
More information about the Chicago
mailing list