Ruby or Python?
-
The better question would be, why or what do you want to learn?
Python would be better for automating admin type duties, Ruby would be better for web development purposes. Python is great for webdev, but Ruby is marginally better IMO. As for Ruby being slower, perhaps. But the gap is much narrower these days. After Ruby 1.8, they really improved the interpreter.
As for how to learn, my standard advice is always to just dive right in. Find something you want to do and do it in that language. Guides, how-tos, etc are much less effective for me than just diving in . At least for me. You already know other languages, you know how to do things. You just need to know how to do them in X language. So do it. Dive in. I learn best by immersion though. Others may learn differently, but for me I do not truly learn until I apply the knowledge, so I just jump right to application.
-
Well... yeah. If you want to use ruby to solve problem X and no one else had used ruby to solve problem X, you're gonna have a bad time.
You're beginning to sound like a coworker from a previous job who couldn't get anything done without copy/pasting from a google search.
-
You're beginning to sound like a coworker from a previous job who couldn't get anything done without copy/pasting from a google search.
If you want to play trailblazer on company time and you're good enough to get away with it, more power to you. I'm not good enough.
-
IBHT
I don't see how the Institute of Beauty and Holistic Training in Kildare, Ireland is relevant.
-
@Intercourse said:
Dive in. I learn best by immersion though.
Oddly enough, when I tried--I'll admit I didn't spend a lot of time on it--I didn't find much in the way of useful reference, just a bunch of "you must be new to programming" stuff.
-
Maybe one of the "Learn X the hard way" would be more up your alley? IIRC, those are written in the style of "you need to know how to program first".
-
Might be.
-
-
Never mind. They are written with beginners in mind.
-
I Have Been Trolled. It's a variation on a meme that was common on the front page comments:
YHBT. YHL. HAND.
You have been trolled. You have lost. Have a nice day.
-
It did look familiar, but I couldn't remember what it was, and the googles did nothing.
I was foiled by a simple character transposition.
-
I didn't notice the transposition until I started spelling it out.
-
@Intercourse said:
I learn best by immersion though. Others may learn differently, but for me I do not truly learn until I apply the knowledge, so I just jump right to application.
I usually need a problem that I really need to solve, first. Actually, the best thing for me is to need to modify / fix something that already exists. Then I can skip whatever boilerplate / scaffolding the language needs and start actually doing something.
-
No, it would be better if it had 0 threading support. Any code where you can speed it up by running a do-nothing busyloop in parallel is deeply WTF-worthy.
Yeah I agree with that. Both languages have shitty threading support, but at least in Ruby it doesn't feel like a total afterthought. And at least Ruby has the technical capability of eventually fixing their threading implementation, even if the current runtime sucks shit. I'm not sure it's even possible in Python.
I'd also say a library full of decades-old unmaintained shit (like Python's) is worse than a smaller library that's kept clean and up-to-date. I wasn't "appreciating" the library's size a year ago as I was going through it looking for a single working implementation of SOAP in Python 2.7. (There were something like 4-5 options, none of which worked. Some of which might have worked in like Python 2.2 but no longer did, but there's no way of versioning them. It was basically hell.)
-
That is one of the strong points of Ruby Gems. It resolves dependencies for you pretty well and throws a meaningful error if things are not compatible. I used to hate Ruby, but it has definitely grown on me.
-
I didn't notice the transposition until I started spelling it out.
That does explain why Google didn't help.
-
@Intercourse said:
After Ruby 1.8, they really improved the interpreter.
Did they fix string concatenation yet or is it still broken to hell?
-
@Intercourse said:
That is one of the strong points of Ruby Gems. It resolves dependencies for you pretty well and throws a meaningful error if things are not compatible.
The Pip/Setuptools/Distutils stack will do this as well, but it does vary somewhat depending on how well package writers have done with writing setup.py.
-
it does vary somewhat depending on how well package writers have done with writing setup.py.
Yeah, that is being fucking nice about it. Package writers typically take the easy way out, forget about their packages and then you go to include it and it is broken all to fuck.
(yes, I have had a few drinks. How did you know? Oh, by the obscenities? That is normal for me.)
-
@Intercourse said:
Yeah, that is being fucking nice about it. Package writers typically take the easy way out, forget about their packages and then you go to include it and it is broken all to fuck.
Either that, or they wind up banging their heads against the wall because they just can't figure out how to get things to be turn-key enough. What does the Ruby world do about the 'lazy package writer' problem, btw?
-
While Ruby has support for various different things, it didn't actually do anything outside of the web world. Where is a ruby game or desktop app or must have system utility? Going into it would feel slightly like locking myself into a rails/sinatra ghetto.
One place where I was pleasantly surprised to find Ruby in is as the language for RPG Maker VX Ace scripts. For some reason I was expecting them to use some home-made kludge instead.
Yeah I agree with that. Both languages have shitty threading support, but at least in Ruby it doesn't feel like a total afterthought. And at least Ruby has the technical capability of eventually fixing their threading implementation, even if the current runtime sucks shit. I'm not sure it's even possible in Python.
It's a CPython and PyPy problem really. Jython and IronPython don't have this issue, and apparently PyPy can eventually grow out of it, too.
-
Oddly enough, when I tried--I'll admit I didn't spend a lot of time on it--I didn't find much in the way of useful reference, just a bunch of "you must be new to programming" stuff.
That's one of my ongoing complaints about programming language guides - they're almost all written for total beginners at programming, or are describing the subtle nuances of some tricky feature. It's much harder to find stuff to get you started quickly when you already know several other languages.
-
I've never touched Ruby - is correct indentation as important in Ruby as it is in Python?
-
It would probably help to describe some of the things you envision doing with it. Personally, I know Ruby pretty well, and am only vaguely familiar with Python. I've found Ruby to be a good tool for day to day automation - moving files around, issuing commands and database queries, reading in and generating file data, etc. If Python is better somehow at any of that, I'd sure like to know how.
Ruby may be slower than other languages at hardcore math, but I haven't had any trouble with it so far. Python does seem to have much better support in terms of native libraries for doing that kind of stuff, though.
The main Ruby page at https://www.ruby-lang.org/ has good docs, especially the Programming Ruby book.
-
I've never touched Ruby - is correct indentation as important in Ruby as it is in Python?
Indentation is meaningless in Ruby.
-
I've never touched Ruby - is correct indentation as important in Ruby as it is in Python?
Quick Google query returns this:
Whitespace in Ruby Program:
Whitespace characters such as spaces and tabs are generally ignored in Ruby code, except when they appear in strings. Sometimes, however, they are used to interpret ambiguous statements. Interpretations of this sort produce warnings when the -w option is enabled.
Example:
a + b is interpreted as a+b ( Here a is a local variable) a +b is interpreted as a(+b) ( Here a is a method call)
Line Endings in Ruby Program:
Ruby interprets semicolons and newline characters as the ending of a statement. However, if Ruby encounters operators, such as +, -, or backslash at the end of a line, they indicate the continuation of a statement.
-
Well that's something, then. That's my main annoyance with Python.
-
It would probably help to describe some of the things you envision doing with it. Personally, I know Ruby pretty well, and am only vaguely familiar with Python.
Heh. Preferably something not web-related, actually.
Let's say, oh, "fuck around writing yet another minecraft clone."
ETA: oh, but I actually don't want to mess with a language whose idea of windowing is "tcl/tk or qt wrapper."
-
ETA: oh, but I actually don't want to mess with a language whose idea of windowing is "tcl/tk or qt wrapper."
What are you seeking here? Directly talking to the W32API? Or something like a .NET WinForm? Or are you a fan of one of the Java toolkits? :(
-
Could always do DirectX or OpenGL for GUI stuff.
-
I actually don't want to mess with a language whose idea of windowing is "tcl/tk or qt wrapper."
Personally, I think that PyQt (or PySide) is actually quite nice; if you object to the stuff the C++ bindings do, don't exclude it for that reason. Python also has GTK bindings, and Mono supports older versions of Windows Forms.
Edit: Where the hell did Mono come from? That's not Python. (Unless you could run IronPython on Mono... that'd be amusing.)
-
Closer to the first two.
-
Well, unless you want fullscreen-only you still need windows and the like.
Having said that something close to the regular win32 api or winforms, like i replied to @tarunik, would probably be most useful to me.
-
Closer to the first two.
There's nothing in Python stopping you from using it to bang Windows API calls directly via ctypes or cffi.
-
the regular win32 api or winforms
It's quite a lot of work to build GUIs on top of the regular Win32 API. Toolkits are used to hide the really boring parts so that you can focus on your application. (Winforms are functionally a toolkit in the sense I'm using in this post.)
-
What are you seeking here? Directly talking to the W32API? Or something like a .NET WinForm? Or are you a fan of one of the Java toolkits? :(
There are plenty of Ruby Gems that allow you to call Windows DLLs directly. I suppose you could use that to call all of the Win32 GUI stuff. The downside is that it's hard to get computer time in a mental health ward.
-
The downside is that it's hard to get computer time in a mental health ward.
That depends on whether the computer has sharp edges.
-
There are plenty of Ruby Gems that allow you to call Windows DLLs directly. I suppose you could use that to call all of the Win32 GUI stuff.
Same holds true for Python, too.
It's quite a lot of work to build GUIs on top of the regular Win32 API. Toolkits are used to hide the really boring parts so that you can focus on your application. (Winforms are functionally a toolkit in the sense I'm using in this post.)
Sure is: W32API requires all sorts of event-loopy, parameter-juggly, callback-ridden stuff to use directly.
-
I remember turning in my A Level Computing coursework in Visual Basic 6 and I was doing all kinds of things VB6 couldn't do - but it could call WinAPI.
My teacher had to grade it on the quality of documentation and analysis/design because he couldn't understand how it worked - merely that he could see it did.
-
Sure is: W32API requires all sorts of event-loopy, parameter-juggly, callback-ridden stuff to use directly.
I know. I maintain code that does that.
-
I remember turning in my A Level Computing coursework in Visual Basic 6 and I was doing all kinds of things VB6 couldn't do - but it could call WinAPI.
I remember once trying to create a WinAPI timer in VBA to make an Excel workbook refresh once a second. It was immensely unpleasant and, for some reason, Excel really hated it and became 100,000 times more unstable as a result.
(Apparently
Application.OnTime
is a thing that exists.)
-
I remember once trying to create a WinAPI timer in VBA to make an Excel workbook refresh once a second. It was immensely unpleasant and, for some reason, Excel really hated it and became 100,000 times more unstable as a result.
(Apparently
Application.OnTime
is a thing that exists.)100,000x more unstable doesn't sound very hard to achieve with Excel.
-
-
-
Not sure if you missed the joke or if you are just trolling...
-
-
Why is a novelty name a good thing?
When I see "PyQt", I know exactly what it does immediately with reasonably high assurance. (Not necessarily how well it does it, but at least what it's trying to do.) I wouldn't with, say, Piqued.
-
When I see "PyQt", I know exactly what it does immediately with reasonably high assurance. (Not necessarily how well it does it, but at least what it's trying to do.) I wouldn't with, say, Piqued.
Yeah, which is why “Pyquet” would have been better.
-
Well, unless you want fullscreen-only you still need windows and the like.
Windows would be sprites drawn via DirectX calls, obviously.
-
Trolling!