|
double home works on ipad, yes, and four finger swipe works from anywhere.
|
# ? Jun 18, 2014 14:14 |
|
|
# ? Jun 8, 2024 08:49 |
|
Otto Skorzeny posted:As a user, my expected behavior here is that if I hit the home button the music keeps playing whereas if I hit the back button the music stops and the app ceases to get cpu time. Perhaps you should tell Pandora that that's what you want their app to do then! If you do really want to stop a badly-behaved application, you just hit the "recent apps" button and swipe the application away.
|
# ? Jun 18, 2014 14:56 |
|
Chromecast is a great example of bad Android behavior. If I use Netflix or Youtube to play Chromecast content, I'll wake up the next morning with a dead phone. This has been a known issue for some time and the only resolution is to force quit any Chromecast-using apps after selecting your content.
|
# ? Jun 18, 2014 15:27 |
|
seiken posted:The original is really really horrible IMO, there's 3 or 4 completely redundant/pointlessly over-complicated things about it. It's not the end of the world but no way I'd let it through code review. InternetJanitor's rewrite takes less than half the time to understand what it does It's also not very 'pythonic'. Although I'm sure the sort of person that uses that term would probably tell you to do it like this: code:
|
# ? Jun 18, 2014 15:43 |
|
I'd like to submit the entirety of SAS. I need to know it to do data analysis because it's worked its way in as a standard tool, but:
who the gently caress wrote this thing it's like it was designed explicitly to allow terrible coding practices and promote syntax errors
|
# ? Jun 18, 2014 16:14 |
|
Those first two are true of C, C#, and Java.
|
# ? Jun 18, 2014 16:42 |
|
GrumpyDoctor posted:Those first two are true of C, C#, and Java. That's true but they don't have an elearning course where a robot lady voice talks about it like it's a feature and you would ever want to do it before saying don't do it. Also last I checked you can code all three of those without shelling out $8770 for the smallest license package. e: well, you don't have to, they have a learning license that consists of a preconfigured virtual machine you load up and swear to God you aren't a business which is what I'm using right now. vv: also the last thing I used prior was python which is probably why I was so upset Shugojin fucked around with this message at 17:06 on Jun 18, 2014 |
# ? Jun 18, 2014 17:03 |
|
Shugojin posted:I'd like to submit the entirety of SAS. I need to know it to do data analysis because it's worked its way in as a standard tool, but: This is true of a great many languages; the only one I can think of offhand that I've used that doesn't permit this is Python. quote:and of course, the markers for comment blocks cannot be in columns one or two because they may in some (but not all!) cases be interpreted as interrupt commands to stop the program! That's a new and exciting way to be terrible, though!
|
# ? Jun 18, 2014 17:04 |
|
It's been coming up on 15 years since I had to work with SAS and that's not long enough.
|
# ? Jun 18, 2014 17:20 |
|
ToxicFrog posted:This is true of a great many languages; the only one I can think of offhand that I've used that doesn't permit this is Python.
|
# ? Jun 18, 2014 17:25 |
|
chippy posted:It's also not very 'pythonic'. Although I'm sure the sort of person that uses that term would probably tell you to do it like this: If we're talking about 'pythonic', you should just write "if toobig". That said, your code completely fails the requirements because it will process the entire 2-dimensional array even if the condition is violated. I think using a generator instead of a list comprehension may be enough to fix it, if you remove the len() as above. I don't know enough Python internals to be sure if it can short-circuit here, though.
|
# ? Jun 18, 2014 17:25 |
Skuto posted:If we're talking about 'pythonic', you should just write "if toobig". Python code:
|
|
# ? Jun 18, 2014 19:09 |
|
nonono, to be Pythonic you simply return [feature.value for d in dimension for feature in d if feature.value > threshold] and leave it up to the caller to stick that somewhere truthy
|
# ? Jun 18, 2014 20:03 |
|
Jewel posted:But apple fixed that (at least with the ipad) where you swipe down with four fingers to bring up the "Apps That Are Open" list, which you can toss them upwards to close them for good, or tap to swap to it. How is this different than what's on android, except for the button you use to open the menu?
|
# ? Jun 18, 2014 20:03 |
|
seiken posted:nonono, to be Pythonic you simply return [feature.value for d in dimension for feature in d if feature.value > threshold] and leave it up to the caller to stick that somewhere truthy Still has the problem of evaluating all elements. The post above you pretty much nails it by using any + the generator, which guarantees early exit.
|
# ? Jun 18, 2014 20:07 |
|
Skuto posted:Still has the problem of evaluating all elements. The post above you pretty much nails it by using any + the generator, which guarantees early exit. If you think being "Pythonic" has anything to do with "avoiding problems" you are sorely mistaken!
|
# ? Jun 18, 2014 20:08 |
|
quote:How is this different than what's on android, except for the button you use to open the menu? Android still has app-related background services that just start and run without any user interaction and you wouldn't know they're there unless you went looking for them in the system menus or installed a process monitoring app. So most Android devices are probably running the Facebook and Google+ services all right now, but going into the recent apps menu won't show that and killing the app won't stop the service (I don't think). E: oops
|
# ? Jun 18, 2014 20:13 |
|
Munkeymon posted:Android still has app-related background services that just start and run without any user interaction and you wouldn't know they're there unless you went looking for them in the system menus or installed a process monitoring app. So most Android devices are probably running the Facebook and Google+ services all right now, but going into the recent apps menu won't show that and killing the app won't stop the service (I don't think). If you really need to care about it, settings -> applications, look at running applications. Usually better than that is to look at what's reporting as using your battery life (although that can be misleading). If you're still using a 2.2 phone in TYOOL 2014 you deserve everything that happens to you. Just buy a blackberry.
|
# ? Jun 19, 2014 04:08 |
|
seiken posted:If you think being "Pythonic" has anything to do with "avoiding problems" you are sorely mistaken! What I hate about "being Pythonic" is that some people are unreasonable and seem to frown on increased readability. For instance, this: Python code:
Python code:
|
# ? Jun 19, 2014 04:29 |
|
So there's a bunch of sql queries in this project, which are built to find specific users for certain promotions (i.e. "currently purchasing item 'x', and previously bought item 'y' in the last 3 months" type poo poo - stuff that marketing has decided is a good idea.) The way this has been built is that relevant SQL queries get added... to the database... as rows... Then the code pulls those rows out, and runs them against the database, one by one, to see if the user is due any promotional crap. The lead dev can't see a single problem with this approach.
|
# ? Jun 19, 2014 06:28 |
|
bobthecheese posted:So there's a bunch of sql queries in this project, which are built to find specific users for certain promotions (i.e. "currently purchasing item 'x', and previously bought item 'y' in the last 3 months" type poo poo - stuff that marketing has decided is a good idea.)
|
# ? Jun 19, 2014 06:29 |
|
QuarkJets posted:What I hate about "being Pythonic" is that some people are unreasonable and seem to frown on increased readability. For instance, this: More or less unrelated, but the order of your "for" clauses is back to front. You'll get a "NameError: name 'x' is not defined" if you try to use that code. (I actually feel it would make a lot more sense if the "for" clauses had to be in the order you've put them in, but the language says otherwise.)
|
# ? Jun 19, 2014 07:38 |
|
Huh? I thought that was correct too but on trying it it's not. What's the right way to write that one-liner? I can't work it out for some reason. Edit: vvv I knew someone was gonna say that when I wrote "right way" You know what I meant; if someone was going to write it in one-line, what's the correct syntax? Jewel fucked around with this message at 08:26 on Jun 19, 2014 |
# ? Jun 19, 2014 08:19 |
|
Jewel posted:Huh? I thought that was correct too but on trying it it's not. What's the right way to write that one-liner? I can't work it out for some reason.
|
# ? Jun 19, 2014 08:22 |
|
That one-liner would be perfectly reasonable if it worked, but python's for clauses have batshit terrible associativity so you can only readably do multiple for clauses in one comprehension when the things you're iterating over are independent of one another.
|
# ? Jun 19, 2014 11:43 |
|
Python code:
Python code:
Python code:
Python code:
|
# ? Jun 19, 2014 12:03 |
Python definitely needs to extend the syntax for for loops to allow constructs like: for x in y in z
|
|
# ? Jun 19, 2014 12:12 |
|
I like Google's Python style guide for list comprehensions: "Okay to use for simple cases. Each portion must fit on one line: mapping expression, for clause, filter expression. Multiple for clauses or filter expressions are not permitted. Use loops instead when things get more complicated." Because basically anything more than [f(x) for x in a if x >= 5] is just a mess
|
# ? Jun 19, 2014 12:15 |
|
It's certainly one of those features that somebody brought up because "it would be cool" and then they debated it on the mailing list for a while, came up with a "correct solution that's consistent with everything else", but never thought about how dumb and confusing it is. Python has a lot of those now. It's really disappointing.
|
# ? Jun 19, 2014 12:37 |
|
Suspicious Dish posted:And so: Huh? It's perfectly clear what this does (flattens a list of lists). I'm not really a Python programmer either.
|
# ? Jun 19, 2014 12:56 |
|
Shugojin posted:I'd like to submit the entirety of SAS. I need to know it to do data analysis because it's worked its way in as a standard tool, but: I literally started a freelance business to avoid dealing with the shambling abortion that is SAS. Don't forget the lamentable "macro" facility: a language based on the idea that the C preprocessor gave you all the abstraction ability you ever needed. ... or the incredibly high licensing fees. SAS pays "affiliated" consultants kickbacks to push SAS licenses on their customers; it's a business model entirely based on selling hard to the people in an organization with the highest score of (available budget / critical thinking ability) and then locking them in as fast as possible to their unholy PL1/macro-processor hybrid. e: Shugojin, if you have any choice in the matter and you haven't already, you need to learn R. It's a different kind of shambling abortion, but at least it's a free one and it still works a hell of a lot better than SAS. Imagine a deranged statistician designing a programming language after reading "Structure and Interpretation of Computer Programs" while on a bad acid trip. Ersatz Haderach fucked around with this message at 13:18 on Jun 19, 2014 |
# ? Jun 19, 2014 13:15 |
|
Ersatz Haderach posted:Imagine a deranged statistician designing a programming language after reading "Structure and Interpretation of Computer Programs" while on a bad acid trip. Maybe it's me but in my imagination the outcome of that sounds like more fun than most of the programming languages we have to deal with. Disclaimer: I've never programmed SAS.
|
# ? Jun 19, 2014 13:33 |
|
Skuto posted:Maybe it's me but in my imagination the outcome of that sounds like more fun than most of the programming languages we have to deal with. R is surprisingly fun, until it's not. The huge number of academics, statisticians, econometricians, whatever writing packages mean that any statistical, machine learning, etc. algorithm you want to play with probably already has a decent implementation in R. And the graphics capability is second to none, especially with some of the better third party packages like ggplot2. But then sometimes you find yourself reading the documentation for the 10,000 *apply (vapply, mapply, sapply, tapply...) functions for the umpteenth time in an afternoon and wondering where your life went wrong.
|
# ? Jun 19, 2014 14:10 |
|
Hammerite posted:More or less unrelated, but the order of your "for" clauses is back to front. You'll get a "NameError: name 'x' is not defined" if you try to use that code. (I actually feel it would make a lot more sense if the "for" clauses had to be in the order you've put them in, but the language says otherwise.) Holy poo poo, no. I am not experienced with Python and looked at that and thought "no way are pythons list comprehensions that backwards". Speaking of backwards, do you like reading code that way?
|
# ? Jun 19, 2014 15:07 |
|
Deus Rex posted:Huh? It's perfectly clear what this does (flattens a list of lists). I'm not really a Python programmer either. It's completely indistinguishible from [x for x in y for y in z]. If you want to flatten something, call a function named "flatten" instead of writing an easy-to-mix-up list comprehension everywhere you want to do it. Some other code snippets which are "perfectly clear" but should be avoided: code:
code:
|
# ? Jun 19, 2014 15:07 |
|
Jabor posted:It's completely indistinguishible from [x for x in y for y in z]. If you want to flatten something, call a function named "flatten" instead of writing an easy-to-mix-up list comprehension everywhere you want to do it. It is most certainly not indistinguishable from that. He was also not saying that's the best way to write that code, just that it is clear what it is doing, which I happen to agree with. It also becomes much more clear when you use reasonable variable names (making some up here): code:
|
# ? Jun 19, 2014 15:25 |
|
Steve French posted:It is most certainly not indistinguishable from that. He was also not saying that's the best way to write that code, just that it is clear what it is doing, which I happen to agree with. It also becomes much more clear when you use reasonable variable names (making some up here): Sorry, that's still pretty indistinguishable imo. Add user, for group in groups, for user in group. Compare that to code:
Especially if you had, for example, "[user.age for user in group" etc. The worst part is when code:
|
# ? Jun 19, 2014 15:32 |
|
Jabor posted:It's completely indistinguishible from [x for x in y for y in z]. If you want to flatten something, call a function named "flatten" instead of writing an easy-to-mix-up list comprehension everywhere you want to do it. Python has no generic flatten. And that sucks. See for example: http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python
|
# ? Jun 19, 2014 15:45 |
|
Skuto posted:Python has no generic flatten. And that sucks. 'Flatten' unfortunately means different things to different people. I meant it like the function [[a]] -> [a], not the one that folds an arbitrarily nested list (i.e. a tree) into a list.
|
# ? Jun 19, 2014 16:16 |
|
|
# ? Jun 8, 2024 08:49 |
|
Jewel posted:Sorry, that's still pretty indistinguishable imo. Add user, for group in groups, for user in group. Setting aside the fact that you must live in a very interesting world where you're completely unable to distinguish between two groups of things that aren't in the same order: It's more than just some arbitrary ordering where it's hard to remember which is the correct one (which I think might be what you mean when you say "completely indistinguishable"). In one case, the identifier group is used before it is defined. In the other, it isn't. That makes it read completely differently to me, and is exactly why when I first saw the (wrong) code that QuarkJet posted I was in disbelief that Python's list comprehensions would be that bad. Turns out because they're not (but they're still pretty bad). Flatten is a red herring, it's completely inapplicable to the original code, which wasn't performing a flatten, and doesn't answer the question of whether a nested for comprehension is good or bad or readable or not. (recursive) flatten would also not work in the following case: code:
|
# ? Jun 19, 2014 16:25 |