|
Python code:
Python code:
|
# ? Mar 10, 2016 15:59 |
|
|
# ? May 25, 2024 05:55 |
|
i get mad now when i have to use a for loop.
|
# ? Mar 10, 2016 16:02 |
|
Barnyard Protein posted:i get mad now when i have to use a for loop. same
|
# ? Mar 10, 2016 16:13 |
|
make your code as declarative as possible imo
|
# ? Mar 10, 2016 16:14 |
|
fart simpson posted:severe stackholm syndrome mods?
|
# ? Mar 10, 2016 16:17 |
|
fart simpson posted:
big_butts = [butt for butt in butts where butt.is_big()] e: lazy_butts = (butt for butt in butts where butt.is_big()) leper khan fucked around with this message at 16:32 on Mar 10, 2016 |
# ? Mar 10, 2016 16:24 |
|
we're not allowed to use linq expressions in our c# code and no one can give me a good reason why. it's so annoying.
|
# ? Mar 10, 2016 16:25 |
|
leper khan posted:big_butts = [butt for butt in butts where butt.is_big()]
|
# ? Mar 10, 2016 16:27 |
|
LeftistMuslimObama posted:we're not allowed to use linq expressions in our c# code and no one can give me a good reason why. it's so annoying. you work for a company that uses mumps.
|
# ? Mar 10, 2016 16:27 |
|
Bloody posted:you work for a company that uses mumps.
|
# ? Mar 10, 2016 16:31 |
|
fart simpson posted:
edit: oops I misread HappyHippo fucked around with this message at 16:35 on Mar 10, 2016 |
# ? Mar 10, 2016 16:32 |
|
leper khan posted:big_butts = [butt for butt in butts where butt.is_big()] but which is more ~pythonic~?
|
# ? Mar 10, 2016 16:33 |
|
HappyHippo posted:this is a weird example because the second one is clearly better? that makes it normal and not weird
|
# ? Mar 10, 2016 16:34 |
|
fart simpson posted:that makes it normal and not weird yeah for some dumb reason i read that as you arguing for the first one
|
# ? Mar 10, 2016 16:36 |
|
HappyHippo posted:but which is more ~pythonic~? the one guido would do obv
|
# ? Mar 10, 2016 16:41 |
|
leper khan posted:big_butts = [butt for butt in butts where butt.is_big()] list comprehensions are ok when theyre small but they get more confusing more fast. consider code:
code:
|
# ? Mar 10, 2016 16:43 |
|
fart simpson posted:list comprehensions are ok when theyre small but they get more confusing more fast. consider lol if you haven't had to deal with nested list comprehensions
|
# ? Mar 10, 2016 16:52 |
|
Oh I've written plenty in my time, creating nested lists and such
gonadic io fucked around with this message at 17:30 on Mar 10, 2016 |
# ? Mar 10, 2016 17:28 |
|
Picture http://www.cs.nott.ac.uk/~pszgmh/sudoku.lhs but I didn't bother separating my functions properly and just did nested list comprehensions saving literally some lines of code!
|
# ? Mar 10, 2016 17:42 |
|
HappyHippo posted:but which is more ~pythonic~?
|
# ? Mar 10, 2016 19:04 |
|
fart simpson posted:
drat there's even a bug in the loop version of the code. just proves the point more.
|
# ? Mar 10, 2016 19:09 |
|
cmon during code review like you dont catch people copy pasting stuff they clearly dont understand from their other code they came up on their own write poo poo out and be declarative and name things well, birch
|
# ? Mar 10, 2016 19:15 |
|
canonically bad example http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html i still dont get why java and java projects are this way
|
# ? Mar 10, 2016 19:17 |
|
don't use spring hth
|
# ? Mar 10, 2016 19:18 |
|
FamDav posted:don't use java hth ftfy
|
# ? Mar 10, 2016 19:20 |
|
Share Bear posted:canonically bad example http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html always relevant: http://java.metagno.me/
|
# ? Mar 10, 2016 19:23 |
|
FamDav posted:don't use spring hth only work on brand new projects in languages/frameworks of the week, forever, never stopping to maintain
|
# ? Mar 10, 2016 19:26 |
|
Share Bear posted:canonically bad example http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html in spring you have proxies which are interface implementations that are not real implementations, but are instead "proxies" that forward the method calls to the interface on to something that actually handles the implementation. a good example is using CXF soap clients. you specify that a bean is a cxf client and give it the interface and endpoint information and behind the scenes cxf builds a proxy that acts like the interface specified, but behind the scenes sends the requests off to a remote webservice. one way to generate proxies is using a factory. If implementing your own factory, you would put it into the DI container as a bean. sometimes the generated proxies are singletons AbstractSingletonProxyFactoryBean is a base class that handles some of the common tasks related to implementation of a factory bean that generates singleton proxies. If you don't do actual irl software development this will be confusing because its not your math homework. If you actually do software development then it makes total sense but you probably will never use it ever yourself because its mostly for use by spring and frameworks built upon spring.
|
# ? Mar 10, 2016 19:29 |
|
Shaggar posted:in spring you have proxies which are interface implementations that are not real implementations, but are instead "proxies" that forward the method calls to the interface on to something that actually handles the implementation. a good example is using CXF soap clients. you specify that a bean is a cxf client and give it the interface and endpoint information and behind the scenes cxf builds a proxy that acts like the interface specified, but behind the scenes sends the requests off to a remote webservice. javas exceptionally poor faculties for abstraction are responsible for this monstrosity
|
# ? Mar 10, 2016 19:55 |
|
fleshweasel posted:drat there's even a bug in the loop version of the code. just proves the point more. the filter version of the code meanwhile isn't python at all, which doesn't prove anything except maybe that it's easy to make things look nice when you don't have to care about real syntax conversely, here's an actual example of the kind of thing i was talking about : JavaScript code:
JavaScript code:
|
# ? Mar 10, 2016 20:26 |
|
Soricidus posted:the filter version of the code meanwhile isn't python at all, which doesn't prove anything except maybe that it's easy to make things look nice when you don't have to care about real syntax
|
# ? Mar 10, 2016 20:31 |
|
Bloody posted:your opinion is wrong you make a compelling argument but i think i'm going to have to stand firm on this issue
|
# ? Mar 10, 2016 20:32 |
|
Soricidus posted:you make a compelling argument but i think i'm going to have to stand firm on this issue butts make me firm too
|
# ? Mar 10, 2016 20:48 |
|
Share Bear posted:only work on brand new projects in languages/frameworks of the week, forever, never stopping to maintain a good strategy but like musical chairs you gotta be sure your not the last one to leave the party, quit early and often
|
# ? Mar 10, 2016 20:51 |
|
yeah but JavaScript code:
|
# ? Mar 10, 2016 20:56 |
|
i don't like .forEach
|
# ? Mar 10, 2016 20:58 |
|
Shaggar posted:in spring you have proxies which are interface implementations that are not real implementations, but are instead "proxies" that forward the method calls to the interface on to something that actually handles the implementation. a good example is using CXF soap clients. you specify that a bean is a cxf client and give it the interface and endpoint information and behind the scenes cxf builds a proxy that acts like the interface specified, but behind the scenes sends the requests off to a remote webservice. time to brew the AbstractSingletonProxyFactoryBean s seriously, i don't understand why there's that much abstraction for your example of a SOAP client, why does CXF need to build a proxy? why don't you know what you're sending your data to already or what type of interface you're going to be using? i also do not understand the need for spring in general, but i am not an architect or lead, i will read about it now
|
# ? Mar 10, 2016 21:02 |
|
Shaggar posted:i don't like .forEach .forEach doesn't really exist in c# and i both get why (its purpose is pretty much always to have side effects) and kind of wish it did
|
# ? Mar 10, 2016 21:03 |
|
gonadic io posted:yeah but point taken on the formatting, but otherwise why is it better? it doesn't state the algorithm any more clearly than the loop version, and its performance is less predictable unless you have intimate knowledge of the optimisations provided by every relevant runtime.
|
# ? Mar 10, 2016 21:06 |
|
|
# ? May 25, 2024 05:55 |
|
the performance is obviously going to be linear in both cases idk how that isn't clear
|
# ? Mar 10, 2016 21:10 |