I don't like Python. Does that make me a bad person?
131–140 of 231 posts
Re: I don't like Python. Does that make me a bad person?
#132Re: I don't like Python. Does that make me a bad person?
#133Earlier quoted context omitted.
Java doesn't require you to define getFoo() and setFoo(). Some best practice advice suggests you do. But you can leave the vars public and just use the . operator, if you choose. It seems like Java wasn't defined in order to be an efficient for a three-person shop to hack in. It was meant to be efficient for a 40 person shop to build code as a team that they can maintain. That said, I dread going back to my Java proj…
Urgh, I learned Java in school and recently had to use Java at work to do some stuff with a bad XML schema (think lots of " " wtf is element "child" for??). I used XStream for it, and started off trying to write the objects the "right" way, i.e. with private members for child nodes and getters and setters for them. However, having drank deep of the Python well, I got about 20 minutes into it before I realised that my…
public Customer(String name, int custId)
do public Customer(CustomerData cd)
where CustomerData is an object. In Customer you would have getters and setters for CustomerData rather than each item that identifies your customer. This is for extensibility: As your app grows, some part of it may need other ways to identify the customer. Adding these ways won't break your Customer interface. That's the purpose of the rigor of the design standard.Now what I do, which goes against stated policy, is keep the CustomerData variables (String name, int custId, and so on) public so I can set them easily. The only time I require getters and setters for primitive types (for example, name) is if I were to read in data from a user generated form that needed to be sanitized.
My apps are full of these customized data objects, and it's a technique which has saved my ass as I added features etc.
Re: I don't like Python. Does that make me a bad person?
#134Earlier quoted context omitted.
It's also a great way of specifying why I love it. Having been bitten on the ass one too many times by typing problems in a Python project, the feeling of confidence I get from doing the Java bureaucracy (to some extent mitigated now I do Scala instead) is something I have really come to love. It's like a security blanket for me.
(Disclaimer: Not meant as flamebait) Not to be a prick, but if you're having "typing" problems with Python, you're using it wrong. Types are almost irrelevant in Python. What matters is whether, in a given situation, the method you're calling is supported and does what is intended. The actual type/class of the receiving object doesn't really matter, ditto for any arguments you pass to the method. While this may seem…
I'd say that strong compiler checks become more helpful as the size of a program increases. You can keep less of a big program in your head, and big programs have more code paths that could potentially need testing.
Re: I don't like Python. Does that make me a bad person?
#135Earlier quoted context omitted.
My impression, although I'm not an insider and could be off base, is that it wasn't conceived to be an enterprise language, but its patterns were. I learned it when I started application programming for my startup (I had been doing scientific routines, i.e. FORTRAN and Mathematica), because I was curious about OO. A lot had changed since I hacked out a little C and assembler on my Mac+ many years ago, and the scale o…
Interesting about objects in javascript. I have actually started feeling that prototype-based object orientation is less tacked on than its class-based cousin. The syntactical implementation is a bit strange (the 'function' keyword for objects, putting functions on the prototype object rather than the object itself), but the mechanism itself seems more generic and flexible. The implementation in Io is better I think,…
Re: I don't like Python. Does that make me a bad person?
#136[deleted]
I will say that when I came to Python I felt much lighter and faster as programmer. You forget how it can be.
And starting into Clojure recently just feels more "right". I avoided Lispiness for a long, long time, but Clojure seems to hit the proper balance for me.
Re: I don't like Python. Does that make me a bad person?
#137Earlier quoted context omitted.
Given a = [1, 2, 3, 4, 5]: Ruby: a.map{|i| i+1}.reject{|i| i%3 == 0}.map{|i| i*i} Python: [i*i for i in filter(lambda i: i%3 != 0, [i+1 for i in a])] Please ignore the fact that the whole operation can be simplified mathematically - nontrivial map-grep-map operations do occur. I find the Ruby version clearer because it proceeds from left to right like a shell pipeline.
I see your point, but I think your Python's not terribly idiomatic and that's a big part of the problem. This is easier to read and understand, only goes through the list twice, and loses nothing in terms of power: [j*j for j in [i+1 for i in a] if j%3 != 0] (And for any given operation, there's very possibly a cleaner way to abstract out the inner list comprehension, which would again make it a lot nicer.) In genera…
[(i+1)**2 for i in a if i%3!=2]
Goes through the list once, and reads like set notation!
(and does i+1 once, which is what I assume you were going for with the separate [i+1 for i in a])Re: I don't like Python. Does that make me a bad person?
#138Earlier quoted context omitted.
This is the main draw for me. Compared to Python, other languages (well, some) seem to require you to do so many things that just seem... unnecessary. I couldn't believe all the junk Java required of me when I took a stab at it. It's like being confronted with some unhelpful bureaucrat: I know what I mean, they know what I mean, but they're damn well going to make me trudge through all the nonsense so that what I mea…
You don't really appreciate Python until you try and program in something like Java again. The following code is readable and I have required a variation of it in a program before: sorted([ord(c) for c in set('letters in this sentence') & set('and this one')], reverse=True) Doing it in Java would be a chore now.
Scala isn't as succinct, of course, but it gets much closer!
Re: I don't like Python. Does that make me a bad person?
#139My personal experience is that the Java-ish languages encourage you to overthink problems a bit. Instead, I suggest that you just do what comes naturally. This will actually get you pretty far, as Python doesn't have that many gotchas (at least in comparison to Java or especially C++).
Re: I don't like Python. Does that make me a bad person?
#140Earlier quoted context omitted.
It's also a great way of specifying why I love it. Having been bitten on the ass one too many times by typing problems in a Python project, the feeling of confidence I get from doing the Java bureaucracy (to some extent mitigated now I do Scala instead) is something I have really come to love. It's like a security blanket for me.
(Disclaimer: Not meant as flamebait) Not to be a prick, but if you're having "typing" problems with Python, you're using it wrong. Types are almost irrelevant in Python. What matters is whether, in a given situation, the method you're calling is supported and does what is intended. The actual type/class of the receiving object doesn't really matter, ditto for any arguments you pass to the method. While this may seem…
I understand the concept, but sometimes in a medium-size project, you just accidentally send the wrong object back. It happens. But Python won't tell you, and it'll blithely wait for the code to get exercised before dying. I don't remember exactly why I was having this problem, but the bug wasn't shallow, and required a certain confluence of exceptions to occur before it would fire. The sort of thing that would even escape most unit testing.
I would never force static typing on Python or Ruby or upon any language that didn't want it, and when I switched to Python I was very pleased with dynamic typing. However, I find myself much happier with the stronger compiler checks. Writing a medium project in Python now frays my nerves!