code logs -> 2011 -> Sun, 06 Nov 2011< code.20111105.log - code.20111107.log >
--- Log opened Sun Nov 06 00:00:02 2011
00:08 You're now known as TheWatcher[T-2]
--- Log closed Sun Nov 06 00:12:40 2011
--- Log opened Sun Nov 06 00:12:59 2011
00:12 TheWatcher [chris@Nightstar-3762b576.co.uk] has joined #code
00:12 Irssi: #code: Total of 25 nicks [0 ops, 0 halfops, 0 voices, 25 normal]
00:13 Irssi: Join to #code was synced in 39 secs
--- Log closed Sun Nov 06 00:14:08 2011
--- Log opened Sun Nov 06 00:14:23 2011
00:14 TheWatcher [chris@Nightstar-3762b576.co.uk] has joined #code
00:14 Irssi: #code: Total of 25 nicks [0 ops, 0 halfops, 0 voices, 25 normal]
00:14 Irssi: Join to #code was synced in 39 secs
00:15 You're now known as TheWatcher[zZzZ]
01:25 Kindamoody[zZz] is now known as Kindamoody
01:38 Attilla [Obsolete@Nightstar-f29f718d.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
02:15 Derakon [Derakon@Nightstar-f68d7eb4.ca.comcast.net] has quit [Ping timeout: 121 seconds]
02:23 Derakon [Derakon@Nightstar-f68d7eb4.ca.comcast.net] has joined #code
03:37 Kindamoody is now known as Kindamoody[zZz]
04:37 Kindamoody[zZz] is now known as Kindamoody
04:47 Kindamoody is now known as Kindamoody|afk
05:17 Kindamoody|afk is now known as Kindamoody
05:35 Kindamoody is now known as Kindamoody|out
05:55 Stalker [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds]
06:00 Derakon is now known as Derakon[AFK]
06:59 ErikMesoy|sleep is now known as ErikMesoy
07:06 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
07:35 AnnoDomini [annodomini@Nightstar-f7eedefa.80-203-17.nextgentel.com] has joined #code
07:37 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
07:37 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
07:37 cpux|33 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
07:38 cpux|33 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Connection closed]
08:20 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
08:20 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
08:27 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
09:02 AnnoDomini [annodomini@Nightstar-f7eedefa.80-203-17.nextgentel.com] has quit [[NS] Quit: Away!]
09:54 Attilla [Obsolete@Nightstar-f29f718d.cable.virginmedia.com] has joined #code
10:22 You're now known as TheWatcher
11:01 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
11:01 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
11:42 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
11:42 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
13:50 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has joined #code
14:04 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has quit [[NS] Quit: Away!]
14:45<~Vornicus> Things that would help development: having a box that looks vaguely like a depolyment environment at all.
15:05 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Connection reset by peer]
15:06 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
15:06 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
15:44 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
15:44 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
15:44 cpux|3 [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [[NS] Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/]
15:49 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
15:49 cpux|2 is now known as cpux
15:58 ErikMesoy [Erik_Mesoy@Nightstar-f7eedefa.80-203-17.nextgentel.com] has quit [Ping timeout: 121 seconds]
15:58
< ToxicFrog>
5 A2 submissions marked so far.
15:58
< ToxicFrog>
One works, two mostly work, one segfaults instantly and one they didn't check in any source code for.
15:58
< ToxicFrog>
The sad part is this is off to a better start than A1.
16:01 ErikMesoy [Erik_Mesoy@Nightstar-f7eedefa.80-203-17.nextgentel.com] has joined #code
16:09 Derakon[AFK] is now known as Derakon
16:26
< TheWatcher>
TF: ... eugh
16:31
< ErikMesoy>
Without a lookup table, is there any way to know what's better of a "Intel Core i7 2670QM" and a "AMD Fusion E350" processor?
16:31 * ErikMesoy is shopping for a laptop and finding himself annoyed at all the lookup on obscurely named things
16:31
< Derakon>
They're completely different manufacturers, so the names provide no basis for comparison.
16:32
< Namegduf>
Even within a manufacturer, you need lookup in general.
16:35
< ToxicFrog>
Yeah.
16:35
< ToxicFrog>
Tom's Hardware Guide does massive benchmark comparison charts that provide a nice shortcut.
16:36
< ToxicFrog>
That said, if you're shopping for a laptop, CPU is one of the least important things as long as it's "good enough", which either of those should be.
16:36
< ErikMesoy>
They're 2.2 GHz Quadcore and 1.6GHz Dualcore. I think.
16:36
< ToxicFrog>
More important: memory, battery life, screen type, size, and resolution, keyboard and touchpad ergonomics'
16:37
< TheWatcher>
also weight, don't forget that one >.>
16:37
< Namegduf>
GPU is also important, as you need to make sure it can do what you want it to.
16:38
< Namegduf>
(Whether it actually needs to be good depends on what you want, but if you don't consider it, then need it, you're screwed)
16:38
< ToxicFrog>
(also the "Fusion" processors are CPU+GPU shared-die processors)
16:39
< Namegduf>
Screen resolution is the hard thing to get nowadays.
16:39
< ToxicFrog>
(whereas Core i7 is a pure CPU and there's going to be a separate GPU or VAU on the board somewhere)
16:39
< Namegduf>
So many manufacturers offering crappy 1366 width displays.
16:40
< ErikMesoy>
Now I feel old. >_>
16:40
< ToxicFrog>
Yeah, there's been a big move to 16:9 displays, unless you're willing to get really expensive laptops with huge screens.
16:40
< ErikMesoy>
I grew up with 1024x, when did 1366x become crappy?
16:40
< Namegduf>
Quite a while ago.
16:40
< ToxicFrog>
I had to get an off-lease discontinued model to get 1280x800.
16:40 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
16:40
< Namegduf>
Standard for 15" used to be 1440x900
16:40
< ToxicFrog>
ErikMesoy: since it offers less vertical resolution than the 1024x768 you grew up with.
16:41
< Derakon>
Widescreen is fine for watching movies, not for dealing with documents.
16:41
< ErikMesoy>
I see.
16:41
< Namegduf>
16:9 is not too bad, and there's a good number of decent resolution displays with that.
16:41
< Namegduf>
What really annoys me is the move to lower resolutions.
16:41
< ToxicFrog>
Namegduf: 16:10 is as cramped vertically as I'm willing to get.
16:42
< ToxicFrog>
I mean, yeah, no aspect ratio is "too bad" as long as it's big enough.
16:42
< ToxicFrog>
But what used to get you a 1280x800 or 1440x900 screen now gets you 1366x768 at best.
16:42
< Derakon>
TF: ehhh, I'd disagree with that "no aspect ratio is too bad" thing.
16:43
< ToxicFrog>
Derakon: disregarding stuff like space and weight~
16:43
< Derakon>
Since you have hard limits on how physically big the monitor can be and how small of a font you can read.
16:43
< Derakon>
Ah.
16:43
< Namegduf>
The laptop I bought four years ago (or more?) had 1680x1050 at 17"
16:44
< Namegduf>
The 15" ones I were looking at were all 1440. I looked recently and you can barely find *anything* above 1366 now.
16:44
< Namegduf>
It's actually gone backwards.
16:44
< Namegduf>
Because they realised that the idiots they want to sell to don't understand resolution.
16:44
< Derakon>
Or don't care.
16:44
< Namegduf>
I'm going to stick with "don't understand".
16:44
< ToxicFrog>
Actually, they realized that 16:9 panels are slightly cheaper to cut than 16:10.
16:44
< ToxicFrog>
For the same total screen area.
16:45
< Namegduf>
That should give more width.
16:45
< Namegduf>
Not less.
16:45
< Namegduf>
1366 is not wider than 1440.
16:45
< ToxicFrog>
Pixel resolution and physical dimensions are different things?
16:45
< Namegduf>
Your point?
16:46
< Namegduf>
I'm not talking about physical dimensions.
16:46
< ToxicFrog>
That said, yeah, if you can also cut down the overall screen size and then convince people it's better because it's "HD Ready" or whatever, even more savings!
16:46
< Namegduf>
"HD ready" is the thing, yeah.
--- Log closed Sun Nov 06 16:52:39 2011
--- Log opened Sun Nov 06 16:52:52 2011
16:52 TheWatcher [chris@Nightstar-3762b576.co.uk] has joined #code
16:52 Irssi: #code: Total of 26 nicks [0 ops, 0 halfops, 0 voices, 26 normal]
16:53
< ToxicFrog>
Derakon: yeah, but I can't game on that.
16:53
< Derakon>
Why not?
16:53 Irssi: Join to #code was synced in 52 secs
16:55
< ErikMesoy>
Man. To hear you guys it sounds like I could throw $2k or thereabouts at one of you, ask "buy me a laptop please and keep the change", and still get something whose only advantage over my current one is fewer bluescreens. >_>
16:55 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [[NS] Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/]
16:55
< ToxicFrog>
Derakon: because as a rule most games (a) don't support resolutions that are taller than they are wide and (b) favour vision to the sides much more than vision up and down anyways.
16:55
< Derakon>
Ehh, processor, RAM, GPU, battery life, etc. are all improving more or less monotonically.
16:55
< Derakon>
TF: okay, then rotate the monitor back when you want to game.
16:56 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
16:56
< ToxicFrog>
ErikMesoy: $2k for a laptop? o.O
16:56
< ToxicFrog>
Do you use this for gaming or something?
16:56
< ErikMesoy>
ToxicFrog: $2k for a laptop, S&H, and paying some nice person on the internet to go shopping for me
17:02
< ToxicFrog>
Ok, sure, I'll take that deal and pocket the remaining ~$1200 >.>
17:05
< ErikMesoy>
Okay, so I was a bit hasty there.
17:05
< ErikMesoy>
I net about $2k a month after taxes and rent, and figured that that was a reasonable starting point for something I would be using several hours a day for years.
17:06
< Derakon>
You could spend $2k on a laptop if you really wanted to.
17:06
< Derakon>
But I suspect you'll be deeply into the land of diminishing returns.
17:07
< Namegduf>
Or getting ripped off *cough*Alienware*cough*.
17:08
< ToxicFrog>
Yeah, once you get above $1000, you're usually getting the kind of hardware that you'd be much better off getting a desktop for.
17:14
< Stalker>
I like my MSI GT740.
17:15
< ToxicFrog>
For example, mine is a Core 2 Duo at 2.2GHz, 2GB of memory, 250GB of hard drive space, 15" 1280x800 screen, bluetooth, etc.
17:15
< ToxicFrog>
Cost ~$400 off-lease.
17:16
< Stalker>
I don't even want to compare, since Denmark has insane taxes on this stuff.
17:18
< ToxicFrog>
This is probably less powerful than you'd want for day to day use (I have a server backing it that I can use for heavy lifting), but you can get something much more powerful for <$1000 without too much trouble.
17:26 * Vornicus is already screwed if he wants to replace his current monitor
17:26
< Derakon>
IIRC you have some ancient CRT?
17:26 * Vornicus is currently using a CRT that he has, on at least one occasion, cranked up to 2048x1536.
17:27<~Vornicus> --m,oslty to prove I could. 1280x1024 is my usual, and in certain specific situations I go up to 1600x1200
17:28
< Derakon>
I'm running 1x 1920x1200 and 1x 1280x1024.
17:29
< sshine>
I've got this monadic expression, do { e <- expr; return $ Foo e } that I rewrote into, expr >>= return . Foo -- I wonder if there's a more general way to do this.
17:31 * gnolam got his last monitor in large part because it actually offered x1200.
17:33
< ToxicFrog>
My old monitor was a CRT flatscreen that went up to 2048x1536 and which I normally ran at 1280x960.
17:33
< ToxicFrog>
I don't miss it in the slightest.
17:33
< ToxicFrog>
Fuck CRTs.
17:33<~Vornicus> I cannot stand LCDs because moving my head at all makes all the colors change.
17:34
< Derakon>
Your LCDs must have had terrible viewing angles.
17:34<~Vornicus> I have never met an LCD with a good one that was less than $500
17:34
< Derakon>
The only color variation I'm seeing from moving my head around is due to changes in glare.
17:35
< Derakon>
Which, well, I'm sitting in a sun room with the sun to my back.
17:35<~Vornicus> And invariably the worst viewing angle on an LCD is the one that changes most often when I'm sitting at my desk: the vertical.
17:38
< gnolam>
Never had a problem with viewing angles. Consumer LCDs' horrible color reproduction OTOH...
17:42 Kindamoody|out is now known as Kindamoody
18:22 * sshine managed to apply Control.Monad.liftM2 and feels cool!
18:25
< PinkFreud>
my pair of Samsung LCDs have been working fine for me.
19:00 Kindamoody is now known as Kindamoody[zZz]
--- Log closed Sun Nov 06 19:10:09 2011
--- Log opened Sun Nov 06 19:10:22 2011
19:10 TheWatcher [chris@Nightstar-3762b576.co.uk] has joined #code
19:10 Irssi: #code: Total of 26 nicks [0 ops, 0 halfops, 0 voices, 26 normal]
19:11 Irssi: Join to #code was synced in 49 secs
19:54
< PinkFreud>
ToxicFrog: sounds similar to my setup (except mine are both the same model).
19:59 Bob_work [NSwebIRC@Nightstar-f9f2b179.static.qwest.net] has joined #code
20:05 * Bob_work growls.
20:06
< Bob_work>
Java fun. I have data from a text file I'm trying to read in. Everything is going fine until I get to a certain part.
20:07
< Bob_work>
In the file, each question and answer is on it's own line. Between the last answer and the next question is a blank line.
20:07
< kwsn>
i'm rusty with java Dx
20:07
< ToxicFrog>
Oh god java
20:08
< Bob_work>
I can read in the question without problem. I go to read in the answer by running a while loop that checks the lines length (if it's zero, it quits the loop), and should be concatting all the answers into a single string
20:08
< Bob_work>
The problem? It simply skips over answers
20:08 * ToxicFrog hands Bob a pistol with two bullets in it. You know what to do.
20:08
< Bob_work>
Oh, and if I simply put i<5 in place of my length checker, it pulls the answers without a problem.
20:09
< Bob_work>
(However, since I'm not supposed to know how many answers the multiple choice questions might have, I need to scale this that way)
20:09
< Bob_work>
also: Damn, writing out the problem didn't help.
20:09<~Vornicus> whne you say "skips over answers"
20:09
< Bob_work>
The answers are:
20:09
< Bob_work>
blah 1
20:09
< Bob_work>
blah 2
20:09
< Bob_work>
blah 3
20:10
< Bob_work>
blah 4
20:10
< Bob_work>
And I get in my string: /blah 2 /blah 4
20:10
< ToxicFrog>
Pastebin?
20:10<~Vornicus> Sounds like you're reading the line again in the condition
20:10
< ToxicFrog>
(also does it have to be java)
20:11
< Bob_work>
ToxicFrog: Well, this is a java assignment. I don't think she'd appreciate a PHP version. >.>
20:11
< Bob_work>
(I would, though.)
20:11
< ToxicFrog>
...
20:11<~Vornicus> what I bet you're doing is this: while(file.readline().length == 0) {answers.append(file.readline();}
20:12<~Vornicus> only, with correct parens, and with the right methods
20:12
< Bob_work>
http://pastebin.starforge.co.uk/485
20:13<~Vornicus> BIngo.
20:13<~Vornicus> 44, 45.
20:13
< Bob_work>
So...fuck.
20:14
< Bob_work>
So it's reading the first line, getting "true", adding the 2nd line, reading the 3rd line as True, adding the 4th
20:15<~Vornicus> correct way to do this is this: while (true) {current_line = in.nextline(); if (current_line.length == 0) break; Answers = Answers.concat("/"+current_line);}
20:16
< Bob_work>
That makes sense
20:17<~Vornicus> Note: this does force a particular restriction that may or may not be problematic: the last question has to have a blank line after it.
20:21
< Bob_work>
Luckily, the last question is not a multiple choice, and we can avoid this issue *this* time.
20:22
< Bob_work>
However, I see your point.
20:22
< Bob_work>
and REALLY appreciate the help. Thank you
20:26<~Vornicus> Also, since this is Java: you may prefer, and it's probably better practice, to create an iterator object.
20:26 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Connection reset by peer]
20:31
< Bob_work>
Ok, I'm probably wrong, but by "iterator object" I don't suppose you mean "int i = 0;", right?
20:31 * Bob_work googles
20:31<~Vornicus> Nope.
20:31<~Vornicus> An iterator object implements the Iterator interface
20:34
< Bob_work>
Looking at examples, would I use one for the scanner, the arraylist, or both?
20:34<~Vornicus> What you'd do is make an iterator that hooks next() to nextline, and hasnext() to your eof hunter
20:35
< Bob_work>
oooooh
20:36 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
20:37 Syloqs_AFH is now known as Syloqs-AFH
20:38<~Vornicus> This gives you a couple of options; you can end up with a state machine using a foreach loop.
20:41<~Vornicus> Also it seriously reduces the surface area of your object, making it less likely you'll screw up
20:41<~Vornicus> Also
20:42<~Vornicus> Java, to my surprise, allows assign in while.
20:53
< Bob_work>
This may be getting too complicated for the assignment at this point.
20:54
< Bob_work>
Or worse, look like I cheated, considering she doesn't think a CIS student can keep up with CS/SE students. >.>
21:00<~Vornicus> I don't know how it gets truth values for an assignment expression, but if it does it so assignment of an empty string counts as false, you might be able to do something like: while (current_line = in.nextline();) { Answers = Answers.concat("/"+current_line);} //finish answers here
21:03<~Vornicus> only without that ; in there
21:05 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
21:06 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has quit [[NS] Quit: Leaving]
21:07 * Vornicus does research.
21:07 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has joined #code
21:07<~Vornicus> Okay, research done.
21:08<~Vornicus> Final answer: while ((current_line = in.nextline()).length > 0) { Answers = Answers.concat("/"+current_line); } // finish Answer
21:10<~Vornicus> (arrays only count as false if they're null.)
21:14 kwsn is now known as kw|GO_PACKERS
21:53 Stalker [Z@2C3C9C.B2A300.F245DE.859909] has joined #code
21:53<~Vornicus> ah, actually java does disallow it, fiddlesticks, why didn't it say that in other places
21:55 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
22:05
< McMartin>
Java's finicky about truth values.
22:05
< McMartin>
Java tends towards the "bondage-and-discipline" approach to programmer specificity, which is often very annoying
22:06
< McMartin>
But I gotta say, people who actively miss while (a = *b++) are suffering from stockholm syndrome
22:06
< Derakon>
But but but saving a line!
22:06
< Derakon>
Must keep the size of my source code down!
22:10
< Namegduf>
It's ugly ugly to repeat a line in and out of the loop!
22:10
< Namegduf>
Saving a line in both places!
22:11
< Namegduf>
This said, I'm fond of the strict "only booleans are valid, write what you mean" thing.
22:11
< Namegduf>
You're saving ... six character in " != 0"
22:11
< Namegduf>
*characters
22:13<~Vornicus> I use empty list as false more often than 0.
22:13
< Namegduf>
Hmm.
22:13<~Vornicus> where it's 11 characters
22:13
< Namegduf>
What language is that?
22:14<~Vornicus> python.
22:14 * Namegduf wasn't aware of that rule
22:14 * Namegduf will refrain from using it himself, though
22:14
< Namegduf>
The problem in particular in Python is that such a check could indicate I expected it to become None at some point.
22:15
< Namegduf>
Or something else entirely.
22:15
< Derakon>
The "empty list has a truth value of False" thing is handy.
22:15
< Derakon>
For example, filtering some set of values, and checking if you got any.
22:15
< Namegduf>
In the case of an integer in a statically typed language, you can read the condition in siolation.
22:15<~Vornicus> From most to least common in other languages: false, null pointers (None), 0 in various types, and empty containers, are all considered false in Python
22:15
< Derakon>
IIRC Perl also considers "0" to be false. ?.?
22:15
< Namegduf>
The empty list thing, you need to read the loop.
22:15
< Namegduf>
Yep.
22:16
< Namegduf>
"0e0" is, however, true
22:16<~Vornicus> There are then languages like perl where you get ridiculous things like strings that, if switched to specific other types, would count as false...
22:16
< Namegduf>
As is "0 but false"
22:16
< Namegduf>
Both of which are 0 when used in a numeric context
22:16
< Namegduf>
Er, "0 but true"
22:17<~Vornicus> and languages where you have true 0s and false ones, and so forth.
22:17<~Vornicus> BUt yeah, my most common use of implied booleaning is empty lists.
22:18
< Namegduf>
If I used that, I'd feel the need to comment it, which loses the conciseness.
22:19
< Namegduf>
But I don't use Python day in, day out
22:20
< Derakon>
Ehh, commenting that is still easier than maintaining a boolean.
22:20
< Derakon>
if not result: # No matches found
22:20
< Namegduf>
Why would I maintain a boolean?
22:20
< Namegduf>
len() == 0
22:20
< Derakon>
...derp.
22:20
< Derakon>
Sorry, my brain's operating at about 60%.
22:20
< Namegduf>
That's okay, mine too.
22:24
< Derakon>
Incidentally, getting the truth value of an empty list directly instead of getting its length and comparing to zero is about 3.5 times faster.
22:24
< Derakon>
(Over 50000 iterations, the former took .00448s while the latter took .0173s)
22:25
< Derakon>
Not that I would consider that an especially worthwhile optimization.
22:25
< McMartin>
That's something that seriously ought to be peepholable.
22:26
< McMartin>
... especially since len() + type analysis can't be broken via assigning new fields, and __bool__ can be.
22:26
< Derakon>
"Peepholable"?
22:27
< McMartin>
"A peephole optimizer should be able to perform this optimization without the programmer having to care"
22:27
< Derakon>
Ah.
22:27
< McMartin>
Much like how, in C on an x86 machine, x = 0; does not translate to MOV AX, 0
22:27
< McMartin>
But instead XOR AX, AX, which is 2 cycles faster.
22:27
< Derakon>
"I see you're comparing this list's length to 0. Let me just test the truth value of the list directly"?
22:27
< McMartin>
"I will compile that down to testing the truth value of the list"
22:28
< McMartin>
It's called a peephole because the way you do it is first you compile it, and then you scan the code for patterns that you can replace with equivalent, faster ones.
22:28
< McMartin>
That's trickier for a language as dynamic as Python, but given that __bool__ is a method and len is not, it's clearly not impossible to do it fast.
22:32 * Derakon tries changing the __bool__ method on a list object, is prevented. Oh well!
22:34<~Vornicus> I do not know if Python does peephole optimizations on directly-invoked python scripts (though you can invoke python on pycs) or on terp commands
22:35
< McMartin>
Derakon: In that case, as long as it knows "this is a list" at compile time, which it should unless you are an exceptionally naughty programmer, those ought to compile down identically.
22:39
< Derakon>
Given that I was doing "if []:" and "if len([]) == 0", it should know that they were lists at compile time.
22:40
< McMartin>
The only reason it shouldn't is if you did something like if f(x): a = [] else: a = {}
22:41 ErikMesoy is now known as ErikMesoy|sleep
22:45
< Alek>
aaaaahahah
23:19 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
--- Log closed Mon Nov 07 00:00:31 2011
code logs -> 2011 -> Sun, 06 Nov 2011< code.20111105.log - code.20111107.log >

[ Latest log file ]