<zoid>
Can anyone here speak to the learning curve between ruby and python? I'm really struggling with Python and I do feel as though Ruby is a far more elegant language.
thecoffemaker has joined #ruby
jcalla has quit [Ping timeout: 240 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NightMonkey has joined #ruby
mossplix has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 264 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
AJA4350 has joined #ruby
<mozzarella>
zoid: it is far more elegant indeed, but they're in the same ball park in terms of ease of learning
mkroman has quit [Remote host closed the connection]
ravenousmoose has quit [Ping timeout: 252 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
sandstrom has quit [Quit: My computer has gone to sleep.]
dinfuehr has quit [Ping timeout: 265 seconds]
dinfuehr has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
suukim has joined #ruby
lalitmee has joined #ruby
dinfuehr_ has joined #ruby
dinfuehr has quit [Ping timeout: 265 seconds]
AJA4350 has joined #ruby
andikr has quit [Ping timeout: 265 seconds]
tvw has quit []
rippa has joined #ruby
sandstrom has joined #ruby
ellcs has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
schne1der has quit [Ping timeout: 265 seconds]
schne1der has joined #ruby
schne1der has quit [Ping timeout: 240 seconds]
Fernando-Basso has quit [Quit: Leaving]
DTZUZO has joined #ruby
schne1der has joined #ruby
DTZUZO has quit [Ping timeout: 250 seconds]
dr_mdma_md has joined #ruby
DTZUZO has joined #ruby
dbugger has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
Intelo has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
Intelo has quit [Remote host closed the connection]
cisco has joined #ruby
DTZUZO has quit [Ping timeout: 245 seconds]
cisco is now known as Guest94053
Intelo has joined #ruby
DTZUZO has joined #ruby
Intelo has quit [Remote host closed the connection]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
jcalla has joined #ruby
mossplix has quit [Ping timeout: 245 seconds]
NL3limin4t0r has quit [Quit: WeeChat 1.9.1]
Intelo has joined #ruby
DTZUZO has joined #ruby
andikr has joined #ruby
Intelo_ has joined #ruby
Guest94053 has quit [Ping timeout: 252 seconds]
Intelo has quit [Ping timeout: 268 seconds]
Swyper has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
jacksoow has quit [Read error: Connection reset by peer]
jacksoow has joined #ruby
AJA4351 has joined #ruby
mossplix has joined #ruby
AJA4350 has quit [Ping timeout: 252 seconds]
AJA4351 is now known as AJA4350
Swyper has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 268 seconds]
NL3limin4t0r has joined #ruby
DTZUZO has joined #ruby
cisco_ has joined #ruby
BTRE has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
Swyper has joined #ruby
rippa has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
DTZUZO has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
bsdband41 has joined #ruby
rippa has joined #ruby
LaChiave has joined #ruby
bsdbandit-01 has quit [Ping timeout: 265 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
phaul is now known as Guest93720
Guest93720 has quit [Killed (niven.freenode.net (Nickname regained by services))]
phaul has joined #ruby
Guest93720 has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 264 seconds]
AJA4351 is now known as AJA4350
cisco_ has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 264 seconds]
haivron has joined #ruby
cisco has joined #ruby
cisco is now known as Guest96816
DTZUZO has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
mossplix has quit [Read error: Connection reset by peer]
mossplix_ has joined #ruby
DTZUZO has joined #ruby
GodFather has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
zapata has quit [Ping timeout: 246 seconds]
zapata_ has joined #ruby
ravenousmoose has joined #ruby
DTZUZO has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yann-kaelig has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
ravenousmoose has quit [Ping timeout: 264 seconds]
<Arahael>
zoid: #ruby probably isn't the best place to be asking about python, but python is getting a bit fragmented. There's a couple of "dialects" of python now, and at least two major dependency management systems.
<Arahael>
zoid: But... Python and Ruby are superficially somewhat similar. "in the same ball park in terms of ease of learning" does sound about right.
DTZUZO has joined #ruby
bsdband41 has quit [Ping timeout: 252 seconds]
bsdbandit-01 has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
Intelo_ has quit [Quit: Leaving]
DTZUZO has joined #ruby
Intelo has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
jacksoow has quit [Ping timeout: 265 seconds]
augcesar has joined #ruby
DTZUZO has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
DTZUZO has quit [Ping timeout: 245 seconds]
KeyJoo has quit [Quit: KeyJoo]
drincruz has joined #ruby
DTZUZO has joined #ruby
kyrylo has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 268 seconds]
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
john__ has joined #ruby
Emmanuel_Chanel has joined #ruby
banisterfiend has joined #ruby
jacksoow has joined #ruby
banisterfiend has quit [Client Quit]
DTZUZO has quit [Ping timeout: 265 seconds]
yann-kaelig has quit [Quit: yann-kaelig]
banisterfiend has joined #ruby
Swyper has quit [Remote host closed the connection]
banisterfiend has quit [Client Quit]
drincruz has quit [Ping timeout: 245 seconds]
john__ has quit [Ping timeout: 264 seconds]
FlorianFa has joined #ruby
suukim has quit [Quit: Konversation terminated!]
DTZUZO has joined #ruby
john__ has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
ElFerna has joined #ruby
ElFerna_1 has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
ElFerna has quit [Ping timeout: 246 seconds]
LtHummus has quit [Remote host closed the connection]
DTZUZO has joined #ruby
banisterfiend has joined #ruby
bacchist has quit [Ping timeout: 276 seconds]
banisterfiend has quit [Client Quit]
banisterfiend has joined #ruby
drincruz has joined #ruby
DTZUZO has quit [Ping timeout: 252 seconds]
AJA4351 has joined #ruby
banisterfiend has quit [Client Quit]
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
mossplix_ has quit [Remote host closed the connection]
ElFerna_1 has quit [Quit: WeeChat 1.9.1]
ElFerna has joined #ruby
ravenousmoose has joined #ruby
<NL3limin4t0r>
I've quite some experience with Ruby and was able to pick up Python quite easy for the sake of answering some SO questions related to regex/Ruby that needed a bit of Python code.
LtHummus has joined #ruby
<NL3limin4t0r>
I haven't wrote an actual program though.
DTZUZO has joined #ruby
ElFerna has quit [Client Quit]
<NL3limin4t0r>
The most anoying thing about Python is the functional style imo. eg. instead of `array.length` you do `len(array)` Calling one method/function still is fine, but I find it quickly becomes ugly when chaining a lot more methods/functions.
ravenousmoose has quit [Ping timeout: 250 seconds]
<NL3limin4t0r>
zoid: ^
DTZUZO has quit [Ping timeout: 240 seconds]
schne1der has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
mossplix has joined #ruby
john__ has quit [Read error: Connection reset by peer]
jacksoow_ has joined #ruby
jcalla has quit [Ping timeout: 268 seconds]
tsujp has quit [Ping timeout: 240 seconds]
vondruch has quit [Ping timeout: 245 seconds]
john__ has joined #ruby
DTZUZO has quit [Ping timeout: 264 seconds]
jacksoow has quit [Ping timeout: 245 seconds]
bacchist has joined #ruby
phaul has joined #ruby
AJA4351 has joined #ruby
tsujp has joined #ruby
DTZUZO has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4350 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has quit [Ping timeout: 264 seconds]
vondruch has joined #ruby
drincruz has quit [Ping timeout: 276 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
vondruch has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
ElFerna has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
Intelo has quit [Ping timeout: 265 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4350 has joined #ruby
john__ has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
kyrylo has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
Guest96816 has quit [Ping timeout: 265 seconds]
Intelo has joined #ruby
brendan- has quit [Ping timeout: 264 seconds]
bsdband28 has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
bsdbandit-01 has quit [Ping timeout: 240 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Intelo has quit [Ping timeout: 268 seconds]
jcalla has joined #ruby
xco has joined #ruby
xco has quit [Client Quit]
bsdbandit-01 has joined #ruby
bsdband28 has quit [Ping timeout: 252 seconds]
xco has joined #ruby
Intelo has joined #ruby
KeyJoo has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
mossplix has quit [Remote host closed the connection]
augcesar has quit [Quit: Connection closed for inactivity]
mossplix has joined #ruby
lucasb has joined #ruby
AJA4350 has joined #ruby
banisterfiend has joined #ruby
banisterfiend has quit [Client Quit]
drincruz has joined #ruby
ElFerna has quit [Ping timeout: 268 seconds]
Inline has joined #ruby
vondruch has joined #ruby
jcalla has quit [Remote host closed the connection]
<robotcars>
trying to standardize some documentation, I have some numbers, could be int, bigint, shard id, or local id… I'd like to replace all non-zero digits with basic sequence… 990000000002085
<robotcars>
becomes 120000000001234 - I'm thinking the best way might be to itterate and replace the diigit until 0 or end of string, adding 1 for each replacement?
<robotcars>
any suggestions?
<dr_mdma_md>
hey, anybody know how soundcloud and youtube manages to keep an imprint of each song and to use this to prevent duplicates?
andikr has quit [Remote host closed the connection]
wildtrees has joined #ruby
redlegion has joined #ruby
brendan- has quit [Ping timeout: 240 seconds]
chalkmonster has joined #ruby
brendan- has joined #ruby
vondruch has joined #ruby
john__ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
KeyJoo has quit [Quit: KeyJoo]
mossplix_ has quit [Remote host closed the connection]
bvdw has quit [Quit: bvdw]
bvdw has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wildtrees has quit [Remote host closed the connection]
akemhp has joined #ruby
wildtrees has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Intelo has joined #ruby
phaul has quit [Ping timeout: 250 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<TomyWork>
dr_mdma_md, is the answer "it's complicated" enough? :)
zapata_ is now known as zapata
<TomyWork>
if your question is instead how to do it on a small scale, take a checksum of each file, store it in your database, look up the checksum in your list to check for duplicates
john__ has quit [Read error: Connection reset by peer]
<havenwood>
robotcars: I don't get the rules.
dinfuehr has joined #ruby
dinfuehr_ has quit [Ping timeout: 268 seconds]
Tempesta has joined #ruby
<havenwood>
robotcars: Oh, okay, I get it.
john__ has joined #ruby
<robotcars>
only issue now is when s > 9 that I end up with a new value larger than I started.
<havenwood>
robotcars: What's the "correct" result for 990000000002085 and why?
<robotcars>
true. my original request is wrong. i'm looking for if its an int 897345 i want 123456, and if its shardid, I want 260000057783097 split the shard and the id as idividiual suquences
<robotcars>
120000000001234
ElFerna has quit [Ping timeout: 265 seconds]
<robotcars>
but I could be happy with either, just want to deassociate my records from the sample
<havenwood>
robotcars: Instead of #split(//) you can #chars or #each_char.
<havenwood>
robotcars: I'd recommend #digits instead to not involve strings in this.
<havenwood>
robotcars: No need for #map! with a bang here - just #map.
<Swyper>
havenwood that's fair but for my purpose I do want the original array modified, or I guess I could assign my old variable to the output of this reject statement
<havenwood>
robotcars: A nice way to say `d > 0` is `d.positive?`.
<Net>
swyper: havenwood mentioned reject! :)
Intelo has joined #ruby
<Swyper>
I know
<havenwood>
A shorthand for `s = s + 1` is `s += `.
<havenwood>
robotcars: s += 1
<Swyper>
I was just explaining why I wanted one over the other Net
<robotcars>
ty
<havenwood>
robotcars: I think you could combine your logic with what I showed with digits to make a good, fast version not involving strings but getting the desired result.
Intelo has quit [Remote host closed the connection]
ogres has quit [Quit: Connection closed for inactivity]
john__ has quit [Ping timeout: 268 seconds]
Axy has joined #ruby
Axy has quit [Changing host]
Axy has joined #ruby
Intelo has quit [Ping timeout: 240 seconds]
Mia has quit [Ping timeout: 240 seconds]
BTRE has quit [Read error: Connection reset by peer]
akemhp has quit [Ping timeout: 240 seconds]
<NL3limin4t0r>
swyper: There is also Array#delete_if which does largely the same thing, but depending on the context the wording might fit better.
<NL3limin4t0r>
#delete_if always returns the array, whereas #reject! only returns the array if there where changes made.
<NL3limin4t0r>
Furthermore #reject! applies changes after iterating the whole array, whereas #delete_if applies changes after each block execution. Which might be relevant in some scenarios.
<Swyper>
so delete_if has a better runtime ?
akemhp has joined #ruby
<NL3limin4t0r>
swyper: It might have, I've never ran tests for it.
<leftylink>
that is interesting. had not thought about that difference
<havenwood>
swyper: I typically use #reject. As NL3limin4t0r points out, #reject! has a weird `nil` return value so it really needs to be used to modify the receiver.
<havenwood>
swyper: Both #reject! and #delete_if use `ary_reject_bang(ary);` under the hood in CRuby.
akemhp has quit [Ping timeout: 268 seconds]
ElFerna_1 has quit [Quit: WeeChat 1.9.1]
<havenwood>
swyper: So #reject! just returns the result of the function: return ary_reject_bang(ary);
<havenwood>
swyper: While #delete_if returns the ary no matter what: ary_reject_bang(ary); return ary;
akemhp has joined #ruby
<havenwood>
Otherwise, they're identical - so same performance.
<NL3limin4t0r>
havenwood: If they call the same function under the hood, why does the documentation state "The array may not be changed instantly every time the block is called." in the Array#reject! documentation, and "The array is changed instantly every time the block is called, not after the iteration is over." in the Array#delete_if documentation?
<havenwood>
NL3limin4t0r: The only difference is the order they call `ary_verify(ary);` and `RETURN_SIZED_ENUMERATOR`.
<havenwood>
NL3limin4t0r: They definitely both call ary_reject_bang() under the hood ¯\_(ツ)_/¯
<havenwood>
NL3limin4t0r: Maybe an implementation detail? Odd.
ellcs has joined #ruby
<leftylink>
lol
<leftylink>
lol
<leftylink>
lol
<NL3limin4t0r>
I do understand why they've choosen to return nil in case of an unchanged array for #reject! though.
<NL3limin4t0r>
If you are planning to uses the modifying version you should aleardy have the array saved inside variable, so there is no need to return the array itself.
<leftylink>
then either: delete_if doc is correct and reject! doc is "correct" but misleading ("may not" still allows the possibility of "is, but may not"), or reject! doc is correct and delete_if doc is outright wrong
<leftylink>
&>> b = []; a = (1..100).to_a; a.delete_if { b << a.size }; b
<rubydoc>
# => [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,... check link for more (https://carc.in/#/r/7yaq)
<leftylink>
lol.
<NL3limin4t0r>
Instead they've chosen to return a truthy value if changed, and falsy value if unchanged. This check cannot be executed afterwards, since you've changed the original.
<NL3limin4t0r>
(unless you dup/clone the array at which point you where better of using #reject)
<NL3limin4t0r>
s/the array/the array beforehand/
Swyper has quit [Remote host closed the connection]
TomyWork has quit [Ping timeout: 246 seconds]
chalkmonster has joined #ruby
ElFerna has joined #ruby
<NL3limin4t0r>
leftylink: Seems like the documentation of #delete_if is wrong, at least when I run the following:
<leftylink>
probably an easy fix to contribute if someone wanted to be able to say "I've contributed (in some way, however small) to Ruby documentation"
<NL3limin4t0r>
yep, it's not often you encounter invalid info in the official ruby doc. this is my second time
AJA4351 has joined #ruby
<phaul>
so who's doing it ? :D
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
<NL3limin4t0r>
I currently don't have the time. If you guys don't have it done tomorrow I'll submit a PR.
<NL3limin4t0r>
The previous documention fix I proposed was simply changing `false` to `true` xD