Re: how to insert random error in a programming

Discussion in 'Python' started by Mark Lawrence, Oct 15, 2012.

  1. On 15/10/2012 20:10, Joshua Landau wrote:
    > On 15 October 2012 14:55, Debashish Saha <> wrote:
    >
    >> how to insert random error in a programming?
    >>

    >
    > You could always just *write* the code with random errors from the start.
    > Try random code, like this:
    >
    > from collections import defaultdict as ð
    >> def ire(ł, æ=[]):
    >> yield [ð(bool, {æ and æ[0]or object(): True}) [ł[0]] or [lambda: (yield
    >> ire(((æ.append(object()), æ[0])[0], ł))), int][(ł>ł[:3])|(ł<=ł[:2])]() or
    >> [1]][0]
    >> print(list(list(ire([2, 3, 3]))[0]))

    >
    >
    > Note that being random code this does nothing other than confuse people as
    > to why it does what it does do even though that is nothing other than the
    > mentioned confusion of others into its purpose.
    >
    >
    >


    I like clearly written code like this

    "
    s = """Gur Mra bs Clguba, ol Gvz Crgref

    Ornhgvshy vf orggre guna htyl.
    Rkcyvpvg vf orggre guna vzcyvpvg.
    Fvzcyr vf orggre guna pbzcyrk.
    Pbzcyrk vf orggre guna pbzcyvpngrq.
    Syng vf orggre guna arfgrq.
    Fcnefr vf orggre guna qrafr.
    Ernqnovyvgl pbhagf.
    Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
    Nygubhtu cenpgvpnyvgl orngf chevgl.
    Reebef fubhyq arire cnff fvyragyl.
    Hayrff rkcyvpvgyl fvyraprq.
    Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
    Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
    Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
    Abj vf orggre guna arire.
    Nygubhtu arire vf bsgra orggre guna *evtug* abj.
    Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
    Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
    Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!"""

    d = {}
    for c in (65, 97):
    for i in range(26):
    d[chr(i+c)] = chr((i+13) % 26 + c)

    print "".join([d.get(c, c) for c in s])
    "

    --
    Cheers.

    Mark Lawrence.
     
    Mark Lawrence, Oct 15, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. globalrev
    Replies:
    4
    Views:
    771
    Gabriel Genellina
    Apr 20, 2008
  2. VK
    Replies:
    15
    Views:
    1,175
    Dr J R Stockton
    May 2, 2010
  3. Debashish Saha

    how to insert random error in a programming

    Debashish Saha, Oct 15, 2012, in forum: Python
    Replies:
    4
    Views:
    230
    Roy Smith
    Oct 16, 2012
  4. Chris Angelico
    Replies:
    0
    Views:
    153
    Chris Angelico
    Oct 15, 2012
  5. Jean-Michel Pichavant

    Re: how to insert random error in a programming

    Jean-Michel Pichavant, Oct 15, 2012, in forum: Python
    Replies:
    0
    Views:
    157
    Jean-Michel Pichavant
    Oct 15, 2012
Loading...

Share This Page