Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

snippet, python

Name: retard 2010-04-02 14:45

i always get hung up on stupid shit. like, i didn't study my python docs or sicp today, i know. but how do i make this into one line? thx /prog/

        d0=fresult[1][0]-fresult[2][0]
        d1=fresult[1][1]-fresult[2][1]
        d2=fresult[1][2]-fresult[2][2]
        d3=fresult[1][3]-fresult[3][3]

Name: Anonymous 2010-04-02 15:01

d0, d1, d2, d3 = map(lambda n: fresult[1][n] - fresult[2 if n != 3 else 3][n], range(4))
python sucks tho

Name: Anonymous 2010-04-02 15:02

You shouldn't because Guido does not like functional constructs like map so you should use a loop instead.

Name: Anonymous 2010-04-02 15:46

>>3
Or you could stop using Python.

Name: Anonymous 2010-04-02 16:30

>>4
Can't use Haskell or LISP for everything you dunce.

Name: Anonymous 2010-04-02 16:39

>>5
Of course you can.

Name: >>4 2010-04-02 16:50

>>5
I don't use them for anything.

Name: Anonymous 2010-04-02 16:52

OP here, so what should i use, if not python? i heard algol was cool.

Name: Anonymous 2010-04-02 18:29

>>3
A list comprehension, actually.

>>8
Python is the best all-round language there is. There are some areas where it's weaker than some alternatives, but those alternatives tend to be much worse in other areas.

Name: Anonymous 2010-04-02 18:37

>>9
A list comprehension, actually.
A list comprehension is a loop.


Python is the best all-round language there is
( ≖‿≖)

Name: Anonymous 2010-04-02 18:39

>>10
A list comprehension is a loop.
As much as a map is. Stay out of the discussion if you don't understand it.

Name: ``fffffff'' 2010-04-02 18:45

This thread was started because someone doesn't really understand it. Mind blown that thread still going past post 2.

Enterprise Software

/YOURANUS/ designs, implements, operates, and improves Enterprise Software Solutions. The ESS practice focuses on e-mail, directory services, collaboration, migration, and enterprise Windows application platforms.

    * Microsoft Infrastructure Implementations
    * Volume Licensing Agreements
    * License Tracking and Management
    * E-Procurement Reporting
    * Exchange Server Solutions
    * Active Directory Integration and Migration
    * Windows Server Solutions
    * Desktop Implementation and Migration
    * Windows Operating Systems
    * Microsoft Collaboration Solutions

Name: Anonymous 2010-04-02 18:46

>>11
What discussion? This thread is an atrocity.

Name: Anonymous 2010-04-02 18:58

Since it's a language that prides itself on "readability", Python should provide better sugar for traversing things in parallel. It's not that uncommon.

Name: Anonymous 2010-04-02 19:05

d0, d1, d2, d3 = [a - b for (a, b) in zip(fresult[1], fresult[2])], assuming that last line is a typo.

Name: ​​​​​​​​​​ 2010-09-09 12:00

Name: Anonymous 2011-02-02 22:37


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List