« first day (1761 days earlier)      last day (3205 days later) » 

2:00 PM
@tristan Cool! Will have to read.
 
user559633
@PatrickMaupin :) Let me know what you think! I'm hopefully finishing the slides today and will add a PDF of the content when done.
 
@MorganThrapp Pretty interesting, listened to a few songs, not really my style. Seems like lots of people in this room like electronic
 
@Kevin Here's something I cooked up when I was learning sed that increments integers. Un-comment the s command at the end of the first line to make it increment by 5, change the number of Is in that command to make it increment by a different number.
s/[0-9]\+/<&>/g;#/[0-9]\+/s/.*/&IIII/g
:a;:d;s/9\(_*\)>/_\1>/;td
s/8\(_*\)>/9\1>/g;s/7\(_*\)>/8\1>/g
s/6\(_*\)>/7\1>/g;s/5\(_*\)>/6\1>/g
s/4\(_*\)>/5\1>/g;s/3\(_*\)>/4\1>/g
s/2\(_*\)>/3\1>/g;s/1\(_*\)>/2\1>/g
s/0\(_*\)>/1\1>/g;s/<\(_*\)>/<1\1>/g
y/_/0/;tb;:b;s/\(I*\)I$/\1/;ta
s/<\([0-9]\+\)>/\1/g
 
@corvid They're the one electronic band I'll go out of my way for.
 
user559633
youtube.com/watch?v=CPmucPjFulI this song is stuck in my head. (caution: nsfw video)
 
2:02 PM
To go to the opposite end of the music spectrum.
 
@PM2Ring That's uhhh..., uhhhh. I mean, it's... You know, you could just... (words fail me)
 
Evening bros
 
I just condensed that sed stuff so it wouldn't take up much room, the real program is a little less cryptic, and contains comments.
 
user559633
Good morning
 
Howdy!
 
2:03 PM
@PM2Ring There's a comment in there?
 
Howdy! Mr
 
@MorganThrapp The hash mark, so /[0-9]\+/s/.*/&IIII/g is commented out.
 
@PM2Ring Ahhh, gotcha. I don't speak sed.
 
@MorganThrapp sed is fun, if somewhat limited. But it is a lot easier to write than it is to read., so heavy commenting is essential in anything that's more than a couple of lines long. :)
 
In Futurama a character remarks on his screenplay "It took me an hour to write, so I thought it would take an hour to read". Only in sed does this principle actually hold.
 
2:09 PM
@Kevin And perl.
 
Here's the (slightly) more sane version, with comments. Unfortunately, pastebin doesn't seem to have syntax highlighting for sed. incr.sed
 
2:24 PM
With pytest how do i test my whole program execution? Something like: ```run("myprogram", "--first-arg")
out, err = capsd
assert out == "You passed an argument"
assert err == None or err == ""
```
I have not been able to find anything with my google-fu
 
Does any use lazy evaluation?
I'm not sure how I would possibly test that. :P
 
It does AFAIK
 
Okay, cool. I figured it would.
 
You can test it by writing a custom __bool__ probably.
 
I also wonder if there's a difference in evaluation between any([foo for foo in bar]) and any(foo for foo in bar).
 
2:29 PM
Or a class that defines __contains__
 
I know the second one is supposed to be faster, but I'm not sure if it makes a difference in lazy/non-lazy evaluation.
 
The list is constructed non-lazily, then evaluated lazily.
 
So the generator is faster because it doesn't have to run through the whole thing?
 
RIght.
 
Cool, thanks.
 
2:32 PM
Interesting edge case: str.join, where passing the list comprehension is more efficient than passing the generator expression.
 
Huh. That's really interesting. How come?
 
@AnttiHaapala Nice to be precognitive, but I don't even want to think about that Q any more.
 
Final size can be precalculated before allocation.
 
@PatrickMaupin not true
both work the same way, but the generator is first made into a sequence
 
2:35 PM
@jonrsharpe I love learning about the internals of Python like that.
I should really learn C.
 
Let me rephrase: Final size is precalculated before allocation (of the final string).
 
@PatrickMaupin the difference is only inside the PySequence_Fast call here
 
@MorganThrapp you might be interested in looking at , then!
 
Which means you need two passes through the data -- one to calculate the size, and one to copy the data.
 
2:38 PM
... and to do two passes, you need a sequence,
 
@jonrsharpe Oooo, thanks. I didn't know that tag existed.
 
cabbage
 
morning davidism
 
cbg
 
which is achieved by PySequence_Fast which for lists returns the original list;
and surprisingly (or not so) for all other types besides list/tuple, resorts to using an iterator (which is then made into a list)
 
2:42 PM
@AnttiHaapala On the one hand, I think we're in violent agreement. On the other hand, one of the answers to the question jonrsharpe pointed out seemed to indicate, not only that join() of a list was faster, but that join() of a list() of a generator was faster than join() of a generator. If that's true, is it still true in Python 3?
E.g. why would it be faster to create the list yourself than to let it happen implicitly?
 
I cannot find any such statement there... can you point me to it?
I certainly cannot see how this could be possible; it should be slower as it does 1 more python function call
 
Maybe I'm misreading this, because I haven't had my coffee yet, but I'll throw it out here and let you read it while I go get a cup.
 
and at least the same amount of internal C calls
 
~ $ python -m timeit '"".join(str(n) for n in xrange(1000))'
1000 loops, best of 3: 335 usec per loop
~ $ python -m timeit '"".join([str(n) for n in xrange(1000)])'
1000 loops, best of 3: 288 usec per loop
 
there is no join of list of generator there yet
$ python -m timeit '"".join(str(n) for n in xrange(1000))'
1000 loops, best of 3: 208 usec per loop
$ python -m timeit '"".join([str(n) for n in xrange(1000)])'
10000 loops, best of 3: 187 usec per loop
$ python -m timeit '"".join(list(str(n) for n in xrange(1000)))'
1000 loops, best of 3: 214 usec per loop
 
2:48 PM
I want to test it with a generator of lists of list generators.
 
the list of generators is the slowest of them all (as expected)
 
DSM
Morning cabbage.
 
Sorry, I meant [] of generator (which IIRC is exactly the same as list() in Python 3)
 
DSM
Are we talking about the old join-listcomp being faster than join-generator fact?
 
I think so.
What is the root cause of the user being able to build the list faster than the system?
 
2:50 PM
Yep
 
$ python -m timeit '"".join(str(n) for n in range(1000))'
1000 loops, best of 3: 263 usec per loop
$ python -m timeit '"".join([str(n) for n in range(1000)])'
1000 loops, best of 3: 231 usec per loop
$ python -m timeit '"".join(list(str(n) for n in range(1000)))'
1000 loops, best of 3: 358 usec per loop
@PatrickMaupin no it is not
python 3 above. str() is slower because it needs to do some unicode hackery.
 
DSM
@PatrickMaupin: you could read me on the subject, or RH instead.
 
ah also, the "genexp" is never faster than a listcomp
it just finishes faster at that point
or if you short-circuit
otherwise it will consume more cpu cycles
 
I didn't get RH's explanation -- the explanation seemed to be about passing a list vs a generator to join. Of course the list is going to be faster -- that's not a surprise. The surprise (to me) is that building the list and then passing it is faster in Python 3, because it was my (obviously mistaken) impression that listcomps became just generators wrapped in lists in Python 3. Was that a simplification that wound up being too unoptimized?
 
time-space tradeoff. Yuck. :(
python 2:
 
2:57 PM
@AaronHall It's not really a time-space tradeoff, because you wind up building the damn list anyway.
 
>>> timeit.timeit(lambda: '-'.join([str(i) for i in xrange(10)]))
2.2980000972747803
>>> timeit.timeit(lambda: '-'.join(str(i) for i in xrange(10)))
2.677999973297119
 
Also, (to return it to the original discussion) -- with this behavior, it's not just the join() case where a listcomp will be faster than a generatorcomp. I could see any() exhibiting the same behavior when the usual situation is that the first match is the last element in the generator/sequence...
 
DSM
@PatrickMaupin: ah, so you're talking about a slightly different subject than RH was on about.
 
Well, yeah, but it was his timeit that started me going down this rabbit-hole.
 
@ovgolovin I'd guess the first pass is to sum the lengths of the strings so as to be able to allocate the correct amount of memory for the concatenated string, while the second pass is to copy the individual strings into the allocated space. — Lauritz V. Thaulow Jan 30 '12 at 13:42
 
3:01 PM
the listcomp was changed to python 3, so that it is almost like a genexp
 
@JanDvorak Thanks for pointing that out. I updated it to read "Flag spam and offensive posts rather than closing them. You can use [tag:flag-pls] to bring them to our attention if necessary."
 
@AnttiHaapala That's what I'm getting at. I thought it was like wrapping a genexp in list(), but it's obviously still more optimal than that if it's still faster to manually build the list than to let join() notice that you have a genexp and build the list itself.
 
DSM
I'd guess that the genexp overhead (could raise a StopIteration at any point, after all) is just too much to overcome.
Actually, that's a good example of a difference between list(expr) and [expr] still in 3:
>>> list(f(i) for i in range(10))
[0, 1, 2, 3, 4, 5, 6]
>>> [f(i) for i in range(10)]
Traceback (most recent call last):
  File "<ipython-input-4-ad6ebf3d30df>", line 1, in <module>
    [f(i) for i in range(10)]
  File "<ipython-input-4-ad6ebf3d30df>", line 1, in <listcomp>
    [f(i) for i in range(10)]
  File "<ipython-input-2-973e46c074ce>", line 3, in f
    raise StopIteration
StopIteration
New question for Python interviewees. :-) Not that we get many here, but still.
 
DSM
What does "looks OK" in that context mean? Are they judging content?
 
3:12 PM
oh cool
 
Judging quality. That's where all the NAA and VLQ flags go.
 
@DSM I don't get why that fails.
 
DSM
@AaronHall: listcomps don't use StopIteration to decide when to stop. So the first simply stops softly if f throws one, but the listcomp thinks something has gone horribly, horribly wrong.
 
IPython (even without the now-optional parts) now pulls in a bunch of other packages, which is annoying me for some reason
 
3:16 PM
f(7) raises StopIteration?
 
DSM
def f(i):
    if i != 7: return i
    raise StopIteration
@davidism: such as? There were always a fair number of dependencies.
 
pip install ipython now installs decorator, ipython-genutils, path.py, pexpect, pickleshare, simplegeneric and traitlets.
That's just the plain interpreter now, none of the notebook, gui, or multiprocess stuff
pip install ipython used to just install ipython
It's not a problem, just annoying when I'm trying to keep track of which libraries in an env are actually requirements for my code.
 
@DSM It makes sense there are still optimized paths there, but it means the stock answer of use generator comprehensions is simplistic.
 
DSM
@PatrickMaupin: I guess, but TBH I don't care about performance differences on this scale.
 
in beautifulsoup how would I add a specific class to all divs?
 
3:30 PM
I saw a really cool demo of Sage last night. I think it's pretty much the same as the top video here: sagemath.org/help-video.html
 
offhand?
 
No, not the same presentation...
 
@DSM I don't often micro-optimize, but when I do, the generator comprehensions beg me to StopIteration.
 
DSM
groan
 
Did you think it to yourself in the right voice?
 
3:32 PM
:D
 
DSM
@PatrickMaupin: I used my own voice. It's my best feature (well, not counting the ability-to-vectorize-code module.)
 
for div in soup.find_all('div'):
    attr = div.attrs.setdefault('class', [])
    if my_new_class not in attr:
        attr.append(my_new_class)
@JoranBeasley there you go
you can be less strict about it: attrs['class'] can be a string, and css classes can be repeated, but this looks nicer
 
Re-cbg
Fellow PyCharm cabbagers - any idea on how to install wheels on Windows?
 
re-cbg @IntrepidBrit
 
3:49 PM
going to lunch. Chow!
 
I hope that was a deliberate misspelling
People in glass houses shouldn't throw geodudes...
 
@IntrepidBrit I suggest lugnuts.
 
@IntrepidBrit pip install wheel_file.whl
 
4:05 PM
ahh ok
I was hoping I could do something like soup("div").add_class("my_class")
 
brief re-cbg
 
maybe I'll just do my_html.replace("<div>",'<div class="my_class">')
seems lame though
 
4:26 PM
sup python! with pexpect, how can I run a script on a remote server and wait for it's execution to complete before continuing?
 
@vinni_f Whoa, vinni -- I just answered that seconds ago...
Err, maybe not exactly that question, but that paper has a lot of good stuff in it.
 
:) will have a look right away
 
It's still on your profile, switch from the Activity (default when you view your own profile) to the Profile tab and it's at the bottom of the right-hand bar. — jonrsharpe 11 mins ago
@Jon ^^^ that should be an answer with a screenshot that has free hand red arrows and circles
 
@JonClements I would, but that would mean revealing how many consecutive days I've visited Stack Overflow...!
 
@jonrsharpe You could cover up a digit or two with the red circle.
 
4:38 PM
I'm at 477 consecutive days on SO.
 
...632
I think I have a problem
 
DSM
The consecutive days doesn't mean much. I've stayed consecutive on days when I was nowhere near a computer. Not sure what counts as a visit.
 
According to Martijn, more than just being logged in, but my guess is not much more than that.
 
I'm on 43, but the sequence was tampered with since I was on holidays in June.
 
17. :/
I'm never here on the weekends.
 
4:42 PM
Hey guys, quick question
 
quick answer
 
if there's a class called FigureBook
do you know which class it's in? It's either in matplotlib, or wx. I searched it on google and
its existence is apparently unknown, I'm reading someone else's code right now
It's not one of the classes that he made himself
OH derp, he imported his own library haha
my bad
 
I want the last 20 seconds of my life back.
 
DSM
I learned something about radar waveform synthesis algorithms, so it wasn't all a waste.
 
4:46 PM
@jonrsharpe ooh, that makes things a lot easier, thanks!
 
@JonClements as requested: meta.stackoverflow.com/a/302378/3001761 (freehand? I'm not an animal!)
 
upped it. :D
If a question is good enough to answer, is it good enough to upvote?
 
guys i need your professional advice about programmer tips
if you wrote a program which take a file and do some modifications, which is correct, to overwrite the original file or to live it and create a new one with a new name?
 
DSM
Overwriting the original is a recipe for data loss.
 
...it depends?
 
4:55 PM
well asking for a default behavior, globally used (if there is some), i know you will lose the original file which is very bad ...
 
With overwriting there's the possibility that you wipe the original data.
 
It's certainly safer to create a new file, make sure it's OK and then, if you want to replace the old file, delete and rename.
 
@jonrsharpe Bah... I should downvote you for lack of freehand... but have a +1 anyway :p
 
Anyone here use mongodb?
 
4:56 PM
Yes, unfortunately
 
@corvid you know better, just ask
 
I assumed that was going to be the start of a comedy routine
 
I'm just wondering if you can tail collections. Like to hold only a certain number of documents
what's the deal with NoSQL? (crowd goes wild)
 
Like in a deque?
 
Hey up
 
DSM
4:58 PM
A guy who says "sequel", a guy who says "ess-queue-ell", and a guy who says "squell", all walked into a bar.
 
@AaronHall yeah, that'd be the same idea
 
so... do it
 
is their a way to write ant tasks into python script?
 
thanks..I will try this
 
5:04 PM
Also Apache apparently have their own Python-based tool that uses ant, so you could look into how they do it: gump.apache.org
 
The first time I was offered a felafel I thought the guy was saying "waffle" and I was wondering why he frying these little round things in a skillet, which was clearly not a waffle maker.
 
@jonrsharpe thanks.. for ur reply
 
I'm going to lead with this quote in my talk: "The Foole doth thinke he is wise, but the wiseman knowes himselfe to be a Foole"
If Shakespeare was so smart, why did he misspell "fool?"
 
Huh. I didn't know you could post an answer to a duped question.
-4
Q: Python range behaviour

padduI am slightly confused why python handles range function differently. For instance, print map(lambda x:x+1,range(20,0,-1)); [21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2] why does it end at 1 instead of 0 print map(lambda x:x+1,reversed(range(20,0,-1))); [2, 3, 4, 5...

Aaaand it's gone.
Nevermind.
 
And on that bombshell... rbrb all
 
5:11 PM
rbrb
 
Rbrb.
 
Who's the more foolish, the fool or the fool who follows him?
rbrb @Jon
 
DSM
@MorganThrapp: caching? That's a go-to answer.
 
@DSM That would make sense.
 
There's a grace period where you can submit an answer after the question is closed.
 
5:18 PM
There's some utility in having followers, but they when they turn into fan-boy sycophants I usually prove their loyalty to be misguided. I'd much rather have friends that put me in check when I screw up.
 
ok
 
5:30 PM
0
Q: python, using .sort() in a function

AlexTSo the idea is simple, it's part of a much more complicated issue, however I am having a simple issue. So I'm making a fun that makes a list, and then returns that list. No issues there, but if I try to return a sorted list it returns 'None'. Here is a simple example of my issue. def sort_list(u...

4 answers
 
user559633
@AaronHall you have fan-boy sycophants?
 
They're very temporary as I do not cultivate them. :D
 
5:51 PM
I like the code at the beginning of this question.
dict_1 = {07: 'zero seven'}
dict_2 = {2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight'}
dict_3 = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'}
Third time's the charm :-)
 
That is quite the question.
 
Ok, upon further examination I partially understand why he has three dicts. It's because a phone number has three parts.
 
yeah that does make sense
but...it also doesn't
 
Not sure what part of the world he's in though, since he's splitting the number into XX-X-XXXXXXX format
'Round here we do (XXX) XXX-XXXX
 
OP is also using re.match and then grabbing .group(0), which is the whole string.
 
5:57 PM
the answer that was posted makes sense although I don't fully understand why it works
 
Because each word form is at the index corresponding to its number.
 
That answer won't satisfy OP because he can't simply copy-paste it in place of his original code
 
So, numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] num=numbers[0] will return 'zero'.
 
yes that makes sense
 
Because 'zero' is at the 0th index.
 
5:58 PM
I don't think he's going to do the leg work of extracting number from the user's input, determining when it's necessary to call the new function, and what old code no longer needs to be used...
 
well that would be a waste of good code
 
And the ' '.join(numbers[c] for c in map(int, number)) calls int() on each character on the input and then joins the element from numbers with that index.
 
what's the best way to find stack overflow questions for python?
 
The search box?
 
I know for javascript, there's always questions for jquery
 
6:04 PM
Map-territory confusion detected. Yet another "how do I remove the quote marks from a string?" question
 
@Kevin dict_1 = {07: 'zero seven', 007: 'double-oh seven', 7: 'just plain 7'} I always get the wrong answer, and it depends on which version of Python I'm using...
... and why do I get a syntax error when I try to add Jame's little brother, 009?
 
in datacenters, what does H+4 repair mean?
 
@PatrickMaupin That's actually one of my complaints with Python. 0 as the first digit of a number as an implicit 'convert me to octal' is super unintuitive.
 
DSM
@MorganThrapp: fortunately they fixed it.
 
The interpreter is very particular about the limits of the Ian Fleming canon.
Pretty sure it's all laid out in a PEP somewhere.
 
6:18 PM
@MorganThrapp it was borrowed from C; however,
$ python3
Python 3.4.3 (default, Mar 26 2015, 22:03:40)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 0123
  File "<stdin>", line 1
    0123
       ^
SyntaxError: invalid token
>>> 0o123
83
 
user559633
@AnttiHaapala I've never heard of a H+4 repair. Maybe there's a product at your/their company named H-something?
 
it is something about service levels
 
@AnttiHaapala You say that like C is intuitive. ;)
 
user559633
Or maybe it's a european service/standard thing.
 
DSM
Maybe they mean that they'll fix something within 4 hours of hearing about it?
 
user559633
6:19 PM
^ Good guess
 
@MorganThrapp it was one of your complaints of Python 2 that are now fixed in Python 3 that you ought to fix.
 
@DSM that is my guess too... so in case of hardware it is 4 hours after I find their contact details and they actually read the mail
 
Hateful Eight trailer looks awesome.
 
@Ffisegydd Yeah, I'm super pumped for it.
 
DSM
6:24 PM
That's the movie by the guy who thinks random pop culture references are witty dialogue in the same way that Billy Joel thinks a list is a song?
 
user559633
@DSM Yep. And the plot is almost always wish fulfillment
 
Pipe down you two.
 
Don't dis' Billy Joel :p
 
user559633
William Joel to you
 
I'll have no one slandering Tarantino (feel free to slag off Billy whats-his-name).
 
6:25 PM
(although We didn't start the fire isn't a favourite of mine tbh, but still!)
 
Hate all you want, those of us with taste know that Tarantino is a genius.
Also, Billy Joel.
 
For those keeping track: I've completed Week 3 of Java class after 3 days. It's starting to drag a bit now ;_;
 
Shame they don't pay at those rates :)
Hey guys - I've done my 4 days - where's my month's pay? :p
 
user559633
@JonClements I work dog hours. You actually owe me 7x
 
Ahhh... I must try that :)
 
6:34 PM
SOLID: I is for Interface Segregation, I'm tying to come up with a Pythonic example that doesn't include copiers or ATM's,
 
argh
@AnttiHaapala you mean the statement if from_num not in num_to_nID? num_to_nID stays a dict and I'm switching from nID_to_num being a dict or a list. And what do you mean the dictionary doesn't do what I want it to do? Is it not checking if the particular value is in the key set? — markk 45 mins ago
I looked at this again and he's right
 
user559633
@AaronHall database or car?
 
@AnttiHaapala I think either dicts or lists were working for him. He just wondered why lists were slower, right? Or am I missing something now? I've slept since then.
 
Sure. why not
 
@PatrickMaupin exactly, but there shouldn't be any reason for the lists to be slower, because the in operation would be on a dict instead
unlike I read originally
 
DSM
6:39 PM
Yeah, both dict insertion and list appending are amortized O(1). If the only changes are in nID_to_num, I don't see why there should be a substantial change.
 
and dict has more overhead in resizing/memory use etc.
 
user559633
@AnttiHaapala what am i looking at here?
 
OK, so Antti wasn't psychic after all.
 
:D
just psychotic
explosion in China, those things just happen there
 
user559633
This was just posted -- how did you find out about it? edit: ah
 
DSM
6:41 PM
I was in HK once when there was an explosion in the bay so bright it filled my room. Freaky.
 
holy christ
 
prolly someone smoked at gas station
 
user559633
"According to Chinese state media, the explosion occurred when a shipment of explosives blew up at about 23:30 (16:30 GMT)."

that will do it
 
user559633
my explosives exploded :/
 
'what are they shipping here again?' 'oh just explo-'
 
DSM
6:42 PM
To be fair, they did their job.
 
user559633
You had one job, explosives... And you did it quite well as it turns out.
 
hey do you guys use numpy?
 
bbiab
 
@user3781180 yes...
 
just ask, don't ask to ask or ask if we know something
 
DSM
6:44 PM
I've been known to dabble.
 
are all np arrays resizable?
is there one that's like classic array where the size is unchangeable after initialization and one that isn't?
 
@DSM Yeah, but it was at a petrol station. That's cheating, really.
 
@DSM Wow that is a ton of contributions dude
 
DSM
You can sometimes make a resized view of an array and sometimes you can't, but you can always make a contiguous copy of an array and change its shape.
 
Ah, but that would require reallocating memory?
I'm looking for some kind of arraylist type thing from np and perhaps change it back to the strict size arrays
 
6:50 PM
I feel like this has to be a dupe: How can I use python in “secret” mode?
 
@tristan I read Finnish online newspapers, they report these incidents like one day before they happen
 
Surely people have asked how to hide the console for compiled python scripts before
 
DSM
@user3781180: it feels like you're trying to prevent something from happening, but I don't know what that is or why it would matter.
 
Incidentally I wonder if ought to be burninated
 
I thought that tag was for spreading rumors about your app
 
DSM
6:52 PM
By "secret" does he just mean "without a console window"?
 
@DSM I think so.
 
user559633
Likely yes, with the connotation of "how does hack"
 
@DSM Im reading from a csv file, and
 
@DSM That is my interpretation, yes
 
it didn't specify the number of fields it would have, and I don't want to create a copy of evvery single csv reader line just to see how many lines of data there would be
 
no console for regular scripts is easy: save as .pyw. No idea if it works for compiled scripts however
 
user559633
So nice of you to waste your time on a comment for that question @Kevin
 
@Kevin Well, OP is compiling to an exe, so I have no idea how you would do it.
 
I'm waiting for my project to compile, so my time is already wasted ;-)
 
6:55 PM
so I just wanted to keep adding fields to the array until the arraylist type is done filling, and then I'll turn it into an np array
 
@MorganThrapp hnnngh
 
DSM
I don't know what arraylists are, but there are already optimized ways to read csv files into numpy arrays. It sounds like you're worrying about things you needn't be.
 
I bet there's a command line option for it. py2exe --invisible main.py or something.
 
Oh.. Could you explain the optimized methods?
 
@AnttiHaapala I spent a couple minutes trying to figure out what OP is talking about, and then I got a headache, so I gave up.
 
6:57 PM
Also I started with java so everything I know is in parallel to java terms
an arraylist in java is an array that can keep growing
 
DSM
@user3781180: ah, so in Python you just mean a list. (Which is backed by an array, and isn't a linked list, but can grow shape.)
 
it basically has a real size of let's say 10, and doubles its size whenever it reaches the cap, but its displayed size is the modified part of the array
ah yeah, isn't that just like var = [] , then var.append()?
 
@user3781180 it does not double actually, and neither in python, but yes, in python you'd use list
yes
 
DSM
Sure.
 
is there a way to translate a list into a np array?
 
DSM
6:58 PM
Yes, just call np.array(somelist).
 
ahh gotcha, thank you!
 
DSM
(Or asarray, which has the advantage of behaving a little better if the argument is already an array, I think -- I'd have to check.)
 
in java terms, the various things expect arguments to be "Iterable" or "Collection" or "List" (or Sequence in Python for random access lists)
 

« first day (1761 days earlier)      last day (3205 days later) »