« first day (2504 days earlier)      last day (2448 days later) » 

2:06 AM
does anyone have experience using jython?
 
2:31 AM
Hi pythonistas, kind of a noob but I am trying to teach myself Python. My project involves using a raspberry pi. I have one app which is essentially an infinite while loop that is listening for a user to press a switch button, and it will set some LEDs accordingly. Apart from that, I have a Flask webserver. My goal is to incorporate these two apps together into one, but the infinite while loop doesn't play well with the web server for obvious reasons.
I am curious about your thoughts to some different approaches to solving the problem.
(a) Two threads (one for the while loop, the other for the web server)
(b) Run the two apps separately and have the while loop send messages through rabbit-mq that the web server will receive and can act on
(c) Launch the while-loop [not in infinite form, obviously] from a post request to an endpoint
(d) something else not obvious to me...
 
 
2 hours later…
4:44 AM
Would someone be able to help me with this?: stackoverflow.com/q/45807858/8099160 (it has been more than 2 days so I know it is safe to post now)
 
wim
5:04 AM
@AshwiniChaudhary that's a nice find on the rolling window dupe, but the answers there are a bit outdated I think. it's from 2011 ...
 
wim
5:40 AM
Is there a dupe for longest common subsequence ? I see these kind of ones a lot
 
5:58 AM
what is an efficient way to do ` grep "somestring" filename` in python
for line in open(file, 'r'):`
 if re.search("somesting", line):
 
6:16 AM
morning
 
6:31 AM
If only want to get the value after : and before |, what would be the regex if string is "a:5 | c:3| myval:10"
in this string I want to get myval value 10 (I cannot do positional split
 
In [2]: {k: v for k, v in (kv.strip().split(':') for kv in s.split('|'))}['myval']
Out[2]: '10'
Not a proper example, but just a reminder that regexp is not the only solution to string handling/parsing
 
@IljaEverilä thanks, i was not sure if regex was better or split strip. I could not make a regex to tell take value after "myval:" till space or |
 
I'm really bad at regexp, but I guess something like r'myval:\s*(\d+)(?:\s+|\|)'?
If the values are digits.
 
no sometimes it can be string too :(
 
6:48 AM
@wim All of them should still work fine though. There's one using tee too.
 
actually it fails because my actual string is "20170821-01:01:19.016443125 something:val|a:5 | c:3| myval:10"
In [80]: [kv.strip().split(':') for kv in line2.split('|')]
Out[80]:
[['20170821-01', '01', '19.016443125 something', 'val'],
 ['a', '5'],
 ['c', '3'],
 ['myval', '10']]
 
Naturally it will fail for strings that are something entirely different...
 
@wim thank you for your response. I dont quite grasp why this (stackoverflow.com/questions/24547641/…) is the solution to my problem. Where would I implement this into the code of my model etc?
 
Hello everyone :) Anyone here familiar with sklearn and feature selection?
 
7:04 AM
cbg
 
> You may ask your question without a preamble.
cbg Andy
 
@AshishNitinPatil \o
 
@wim Nevermind you weren't responding to me...
0
Q: LSTM Autoencoder no progress when script is running on larger dataset

Julian RachmanThe shape of p_input in this LSTM Autoencoder for "test.py" is (128,8,1); meaning 128 sets of 8 digits. I am trying to adapt this model to time-series-based data with 4 sets of 25,000 time steps (basically 0 seconds to 25,000 seconds). I tried to input this dataset into p_input with the shape (4,...

 
7:30 AM
>>> importlib._bootstrap.__name__
'importlib._bootstrap'
>>> importlib._bootstrap.__spec__.name
'_frozen_importlib'
This doesn't look right...
 
recbg
 
cbg
 
howdy folks, glad I found this chat finally
anyone here familiar with using google app engine?
 
@Skyler come on, you aren't new here. sopython.com/chatroom
> You may ask your question without a preamble.
 
@vaultah Glanced right over that, though to be fair I am new /here/
my bad my bad
 
7:41 AM
Mar 28 '16 at 20:07, by Skyler
Hello to the people of this room
umm... no.
 
grandpa forgets sometimes
thats really cool btw, how did you find it
can i find all my old messages?
 
there's a searchbar in the top right.
 
Oh, and I guess there really aren't too many Skylers
 
also:
Mar 28 '16 at 20:12, by Skyler
@DSM wasnt that saying its optional to ask a preamble
 
so that makes sense
 
7:45 AM
I used the user id
while there might be several skylers, there is exactly one user 507974
 
@AnttiHaapala please do forgive me Antii Haapala, my memory of a room I visited 15 months ago briefly is a tad rusty
 
I can forgive that, but I cannot forgive you typoing my name when it is spelled out for you right on that line :D
 
Does anyone know a way to find out how much memory is kept alive (e.g. would be eventually garbage collected) because of a closure in CPython? E.g. by the inner function of a decorator?
 
def f():
    x = 5

    def g():
        return x

    return g


g = f()
print(g.__closure__.__sizeof__())
# 32
 
Ah, that looks promising, but doesn't that just show the size of the closure + 8*(number of objects in the closure)?
 
8:01 AM
Hmm, I think you're right. Changing x to a massive list didn't change the output.
This is better, but not sure if it's accurate now:
print(sum(cell.cell_contents.__sizeof__() for cell in g.__closure__))
 
Thanks. Just found the cell_contents myself. :)
 
Anyone know where <class 'cell'> is defined?
 
8:16 AM
Oh, sorry I meant "where can I import it from" :(
There, this seems to work.
Code stolen from here and extended to support cells
 
nice, only thing I still need to do is add a recount check. wow!
 
jjj
cbg
I wonder, why would someone declare utf-8 encoding if their file is not in the utf-8 encoding?
A .py file. Thats just mean.
 
8:50 AM
I'm getting a lot of UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 108: ordinal not in range(128)
Would I resolve this by using .encode('utf-8') on all input that I can't control?
I'm scraping stuff from websites
so by using encode on all that scraped data, would that resolve it?
Ignore my previous question please
 
9:22 AM
cbg
 
 
1 hour later…
10:28 AM
Stupid encoding, I can't get it to work!
print 'aa' + 'hallå'.encode('utf-8')
is giving me
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
By setting this at the top of my files works, but it does not feel like the right approach
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
 
I don't think you ever want to call encode on a string. Only on unicode objects.
 
@simeg That's Python 2 being helpful for you
 
@IljaEverilä How do you mean? I don't find it very useful, it's working against me it feels like :(
 
What happens is actually an implicit decode-encode: 'hallå'.decode('ascii').encode('utf-8'), because clearly you wanted that.
In Python 3 calling encode() on a byte string would get you an AttributeError, because bytes don't have the method encode.
 
Okay, not sure why it's encoding to ascii first. And yes I'm using Python 2.
Could you explain? =)
 
Thanks
 
> Essentially when you have an operation involving a byte-string and a Unicode-string, the byte-string is promoted into a Unicode string by going through an implicit decoding process that uses the “default encoding” which is set to ASCII.
So all in all, if you're new to Python, stop using 2 and move on to 3. That's where the future is.
 
Ok. Thanks for the advice, maybe I'll try to migrate this project to v3 if it's not too big of a hassle.
 
And as you're from up north, doubly so. Handling our äs and ös is pain in 2. You can get it right in your own code, but when you start using 3rd party libraries...
 
Mm ok, that single reason convinced me. I'm gonna do it. Because this project is all about scraping stuff from the web which can contain whatever
 
10:49 AM
kål @simeg
 
@AnttiHaapala Cabbage indeed
 
Kill Python 2, with fire.
incinerate, obliterate...
 
Incendio!
 
@AshishNitinPatil is that a spell from Harry Potter?
 
@AnttiHaapala More like skål :P
 
10:52 AM
well that's good too
 
this is for simeg^
@simeg you work for S, do you know a certain crazy Pythonista named Jyrki P. there?
 
@AnttiHaapala Skål på dig också. Yes, in fact I do know of him.
I've worked with his Python code actually
 
he was the chair of Python Finland until switching to S.
Please pass greetings from Python Room on Stack Overflow and me :D
 
Cool! I don't know him personally and we no longer work in the same building, but if I see him I'll make sure to tell him =)
Is he a regular visitor here?
 
11:00 AM
no, he's never been here afaik, but there's always the first time :D
 
I think he recently had a baby, less time for coding I guess :D
 
11:11 AM
yea
 
11:36 AM
python 2 is the only bad thing about it
 
Is setuptools only useful if you want to package your code so other projects can use it?
 
11:55 AM
@simeg I guess that'd depend on how you're planning on deploying
 
@IljaEverilä I'm using Heroku, and the deployment is already setup.
 
@simeg So you're using a requirements.txt for dependencies?
 
Yes
 
I've never used Heroku, so just read the 1st hit from google :)
 
12:16 PM
for i in range(100): print('cbg')
 
user8451312
I have some pre precessing here,but if i want preprocessed text to return, a can't just write: preprocessing(example) and print(example), i have to print(preprocessing(example)).
Why that happens, because i assigned new values to the variable text inside the function?
 
user8451312
def preprocessing(text):
    #replace @
    text=[re.sub(r'http\S*', "URL", tweet) for tweet in text]
    text=[re.sub(r'@NAXIStaxi', "mentionnegative", tweet) for tweet in text]
    text=[re.sub(r'@banca_intesa|@TelenorBanka|@RaiffeisenBanka|@kombank|@TelenorSrbija', "mentionpositive", tweet) for tweet in text]
    text=[re.sub(r'[0-9]', "", tweet) for tweet in text]
    text=[re.sub(r'_', " ", tweet) for tweet in text]



    #remove special characters
    text=[re.sub(r'[^a-zA-Z0-9]'," ",tweet) for tweet in text]
 
because you're returning a thing called text
preprocessing(example) returns a thing, print(preprocessing(example)) prints that thing, print(example) tries to print the input to preprocessing
the equivalent is result = preprocessing(example); print(result)
 
You're creating a new list and returning it, you're not modifying the input list.
 
on two lines with no semicolon but I'm lazy
 
user8451312
12:21 PM
Ok, so i have to create a new list, in the code, thanks guys
 
Following statement throws wrong syntax in python3 at the `(` after lambda:
`sum(map(lambda (start, end): end-start, regions))`
Any help?
 
@hope94 you're already creating a new list in the code :|
please read what I wrote, because based on your response you completely misunderstood
 
@AdityaC remove the parentheses around start, end
 
user8451312
i just have to name it differently, thats what i understood
 
@hope94 You seem to think that assigning text = somethng_else modifies the input list, is that right?
 
user8451312
12:24 PM
wait wait, i gotta read again all you wrote
 
@AdityaC Tuple unpacking in arguments has been removed in Python 3. If regions contains tuples, or any sequences of 2 items, you could use itertools.starmap, which will in effect call the provided callable as f(*item)
 
@Rawing Upon removing the braces, I get the following error:
`TypeError: <lambda>() missing 1 required positional argument: 'end'`
 
Ilja nailed it
 
@AdityaC Yeah, my bad. Should've paid more attention to the rest of the code.
 
I didn't realize that intent at all
 
user8451312
12:26 PM
well i now really don't understand how to modify original list i taught to do like this:

text1=[re.sub(r'http\S*', "URL", tweet) for tweet in text]
return text 1
 
of course one can always do lambda limits: limits[1]-limits[0]
@hope94 text1[:] = ...
 
@IljaEverilä Can you point to a code example?
 
@hope94 please read nedbatchelder.com/text/names.html to understand how mutation and rebinding works
 
@AdityaC from itertools import starmap; sum(starmap(lambda start, end: end - start, regions))
 
user8451312
@AndrasDeak ok, i will start right now. Thanks
 
12:28 PM
@hope94 No, that doesn't modify anything. You have to understand the difference between a variable and its value. You're removing the value from a variable and putting a new value into it. You're not actually modifying the value.
 
@hope94 this specific syntax for mutating a list might not be in there, but you need to first understand the underlying dynamics before we can discuss the semantics of mutation
then we can get back to your actual problem
 
@AdityaC The PEP discussing the removal: python.org/dev/peps/pep-3113, docs on starmap: docs.python.org/3/library/itertools.html#itertools.starmap
@AdityaC And finally, you don't need starmap either, you could simply use a generator expression sum(end - start for start, end in regions)
 
Thanks @IljaEverilä
 
you really don't need to star everything
 
Please don't star messages like that. Stars are for messages that other chat dwellers will find interesting/fun, not for answers to your questions.
 
12:33 PM
@AndrasDeak can we star that...?
 
>:|
 
@AndyK Wouldn't be the first time that's happened.
 
Channel admins will sort it out promptly I guess
 
users other then Kevin are more resistant to that
 
12:34 PM
Aaaaaand it's gone
 
@IljaEverilä yeah, but it might be easier to perpetuate best practices than having to clean up
 
Sure thing, just referring to this incident
 
@AndrasDeak ;)
 
morning cats
 
@corvid \o
@Rawing quite true
 
1:14 PM
Would it be okay to do something like this - to make the code more readable:
        root.grid_rowconfigure   (1, weight=1)
        root.grid_columnconfigure(0, weight=1)
(just imagine it continuing a lot longer)
 
user8451312
So, i can just do: example= preprocessing(example)

According to this example:
 
user8451312
def augment_twice_good(a_list, val):
    a_list = a_list + [val, val]
    return a_list

nums = [1, 2, 3]
nums = augment_twice_good(nums, 4)
print(nums)         # [1, 2, 3, 4, 4]
 
What is your goal?
 
@hope94 Yes that is a way to do it, if you do not mind example being changed
 
user8451312
I want example to be changed. But here is the thing. This fuction is used by vectorizer, so i can't control what happens with example after function finishes. And i need vectorizer to use changed example. So i need to return already changed example, cause i cant change it after that.
 
user8451312
1:22 PM
@SebastianNielsen a couple of posts above there is my problem that i posted. I am not allowed to repeat it.
 
@hope94 that's fine
You can either mutate your input, or rebind the name to whatever the function returns.
mutation inside a function can more easily be confusing and be harder to test/debug
 
@hope94 If you do example= preprocessing(example) , anything that you pass example to after that will have the changed example.
 
So yeah, in your original code the "problem" was that the function didn't mutate the input, but created a new list. Well, the problem was that you didn't keep the new list that the function returned :)
 
@SebastianNielsen PEP 8 says "no"
 
PEP 8 huh? I'll take a look at that.
 
1:28 PM
 
@SebastianNielsen you maybe can use a linter for such things
 
Most IDE's have auto pep8 plugins and linters
 
Perhaps "peppate" will become a verb among Python devs, as in "You need to peppate your code before checking it in."
 
I hope not
 
May I post 10 lines of my code, to show you why it would massively increase readability of my code by indenting that weird waY?
 
1:29 PM
@SebastianNielsen Sure, go ahead
 
Example 1:
    self.top_frame  = Frame(root, bg='forest green', width=200, height=100)
    self.ctr_frame  = Frame(root, bg='RoyalBlue1',   width=200)
    self.bot_frame  = Frame(root, bg='cyan',         height=50)
example 2:
        self.rentabilitet = Button(self.ctr_mid, text='Remtabilitet', padx=35)
        self.choose_bt    = Button(self.ctr_mid, text='Regnskab',     padx=35, width=35)

        # layout all of the ctr_frame objects
        self.rentabilitet.grid(row=0, column=0, sticky='nsew')
        self.choose_bt.grid   (row=1, column=0, sticky='nsew', columnspan=2)
As you can see, when I keep everything aligned, everything looks a lot nicer dont you think?
I am just wondering whether if this is enough to break the "python rules"
about indenting
 
What do you want us to do/say with this? It's all valid Python.
You are signing up for more align/realigning as the code changes over time.
 
@SebastianNielsen Its definitely a preference thing. I can see what you mean, but also I feel that structuring the code almost table like could reduce readability by breaking the 'flow' of the code. Ontop of that, getting into the habit of using PEP 8 is good if you intend on writing commercial/open source python stuff, as its industry standard
but its up to you, most people will say go with pep8 over that
 
I just prefer this way :/
 
then do it that way :p
 
1:33 PM
In my opinion it makes it more readable, than following the rules of PEP8
 
(of course unless you are in a professional environment with a set style guide)
 
I am just worried that if some feature boss should take a look at it, they would instantly denounce me for my code writing style.
 
is there a style guide where you work?
 
No, I don't currently have a job.
 
ahh ok thought you were talking about a current position :p
 
1:34 PM
Decide how worried you are about it, and then do it or don't
 
But I bet that they are searching for employees that are writing nice clean maintainable code.
Well okay, thanks for the input guys, I just wanted another point of view on the subject from a more experience person.
 
I don't think it'll be a major factor in a job interview, but I reckon any work will expect you to code by their style guide
this is so that all code is similar and can be easily read by all devs
 
The thing is, in your first example, if you change the background color from 'RoyalBlue1' to 'PeppermintPink27', you will have to also update the spacing on the 2 surrounding lines, which has a ripple effect in the source code management system
 
@PaulMcG very valid point
 
1:36 PM
Making gratuitous whitespace changes just to keep the tabularism
 
Yeah that could become an issue.
 
And extraneous changes make it harder for your coworkers to do code reviews, as they have to sort out which ones are significant and which ones are just whitespace
That being said, I have done this same kind of formatting myself, for just the same reasons - in some cases, it makes the reviewing easier because of the alignment.
 
That is some very good points.
 
Just have a good reason for what you are doing - if not, PEP 8 is a safe fallback
 
I guess I will go with my "own formatting" for now, since I will be the only one working on this little tkinter project.
And it makes it easier imo to read the code.
 
1:40 PM
Ye no harm done, if it makes it easier for you to read in your personal projects, more power to you
 
user8451312
def custom_tokenizer(text):
    tokens = ' '.join(text).split()
    #filtering
    tokens = [token for token in tokens if len(token)>=3]
    return tokens


cv=CountVectorizer(tokenizer= custom_tokenizer,analyzer ='word',encoding='utf-8',\
                   min_df=3, stop_words=frozenset(stopdict))

post_text_trainCV= cv.fit_transform(post_text_train)
 
user8451312
Why do i get ValueError: empty vocabulary; perhaps the documents only contain stop words
I know there are some tokens shorter than 3 char??
The last line uses that function, multiple times, i dont know why and how.
 
Just beware of getting into coding habits that you may have to unlearn later. This is very easy when you are on a team of just yourself.
 
Thanks for the advice, I'll keep that in mind.
 
@hope94 could you post the stacktrace and the dict?
 
1:42 PM
brainfart.
 
user8451312
@dhdavvie this is a part of the list of tokens: ['banke', 'zele', 'finansirati', 'realni', 'sektor', 'mi', 'projekata', 'url', 'sberbankbh', 'vi', 'klixba', 'vanjabursac', 'greblaher', ]. Token is a word in this list
 
' '.join(text).split() causes an input of 'hey there' to turn into ['h', 'e', 'y', 't', 'h', 'e', 'r', 'e']
guessing that isn't intended behaviour
instead do text.split to get ['hey', 'there'] for input of 'hey there'
 
user8451312
@dhdavvie text here is a list of sentences
 
user8451312
so i get this list when i do that: tokens=['banke', 'zele', 'finansirati', 'realni', 'sektor', 'mi', 'projekata', 'url', 'sberbankbh', 'vi', 'klixba', 'vanjabursac', 'greblaher']
 
\o cbg
 
1:47 PM
@hope94 what is text? is text already a list of tokens? if so you don't need to split it
 
user8451312
@dhdavvie i wrote in last reply that text is a list of sentences
 
ok ok thanks, was just double checking :p
 
user8451312
i cant figure it out for a long time. Something weirt is happening in tokenizer...
 
user8451312
weird*
 
could you post the stacktrace? the list comprehension is working on my end :/
 
user8451312
1:50 PM
what is stacktrace?
 
The full error that the console gives you
 
user8451312
I hope i will copy the right thing :D
 
user8451312
File "<ipython-input-46-736576cde2a4>", line 1, in <module>
runfile('C:/Users/Nada/Downloads/KlasifikacijaNada.py', wdir='C:/Users/Nada/Downloads')

File "C:\Users\Nada\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)

File "C:\Users\Nada\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Nada/Downloads/KlasifikacijaNada.py", line 96, in <module>
 
I think the culprit is somewhere in the code you replaced with #filtering.
 
ye it doesn't look like its in the snipper you posted
 
1:54 PM
Last time we got this error, tokens was empty because something filtered out too much.
 
user8451312
@Rawing i didnt quite understand first reply?
 
Your real custom_tokenizer function is more than 5 lines long, right? You're doing more than just calling .join and filtering out words with less than 3 characters
 
is there any way to check the output of the custom tokenizer? could you do a print(tokens) right before the return?
 
user8451312
Rawing, the rest of the code inside the function is commented out and i didn't run it.
 
user8451312
Can i send picture here?
 
1:58 PM
you should be able to upload
right next to send button
 
user8451312
i dont have it, i just have send
 
thats odd, I have a button
but ye, add a print statement and copy the output to us
 
user8451312
But there are like 15 thousands of tokens? Should i print len or smth like that
 
user8451312
i dont have that button, i am not blind :D
 
user8451312
2:00 PM
i just have send.
 
maybe you need more rep? oh well
 
I don't believe you; take a screenshot and send---oh.
 
the error seems to coming from the function within this line: post_text_trainCV= cv.fit_transform(post_text_train)
what is in that function?
 
user8451312
 
user8451312
i dont have it, you see?
 
2:03 PM
weird
 
could indeed be an undocumented low-rep restriction
 
@hope94 you need 100 points
 
user8451312
oh so that is :D
 
there we go, thought so :p
 
in term of rep. I remind something like that
 
2:04 PM
I only knew about the "no profile picture" and "no room-owning" restrictions
 
so back to the code
 
13
A: SO Chat No Upload Button

animusonYou aren't allowed to upload images in chat until you reach at least 100 reputation, earned with the create chat rooms privilege. What other new privileges in chat do I get? At 100 reputation you also get access to the "Upload image" button in chat.

TIL
 
could you do a print(len(tokens)) before the return tokens?
just so we're sure the tokenizer is working as expected ish
 
user8451312
i can
 
adding print statements everywhere should've been the first step of debugging :/
 
2:06 PM
well...
 
cbg all
 
its an art form, flooding code with print statements
 
mystifying debugging is probably not helpful for a newbie
it's something like day 12 of programming for hope94
 
user8451312
The len of tokens is 0 all the time after the filtering. And after spliting it is: 77, then 111, then 112, then 88, then 14... This is not from the start and this is not the end, cause it does this like a million thousand times, so i stopped it before it finished.
 
user8451312
Rawing i was doing that
 
2:09 PM
I use www.pythontutor.com/visualize.html sometimes before flooding with print statements. Spyder and Thonny have similarly helpful features.
 
user8451312
thats how i noticed that it goes througs the same line multiple times
 
pdb
 
user8451312
what is pdb
 
yes
 
Communication Level: over 9000
 
2:10 PM
anyway, you might not make good use of a debugger at this level
I still believe that learning some fundamentals first would be most beneficial
 
user8451312
Andras, can u hel with this or?
 
or.
 
user8451312
not
 
@hope94 www.pythontutor.com/visualize.html lets you see what's happening to variables etc at every step in the code, kinda like a frame by frame replay.
 
sounds like half a debugger
 
user8451312
2:13 PM
i will try it
 
what are you coding in?
 
user8451312
spyder
 
@AndrasDeak it's been helpful for me, although I haven't used it as much as I've learnt more. It beats putting print statements everywhere and then having to figure out what you're seeing and what it refers to.
 
it wasn't a complaint:)
if you like that, you should try a debugger too [edit: you might already know this too, I missed the past tenses first]
pdb is the official one that comes with python
it's less fancy, obviously, but it lets you interact with the workspace
you can also just run your program and work once it dies
 
DSM
I get by with mostly print, FWIW. What matters is that you know where to look and what to look for.
 
2:16 PM
that is probably not the case here...
 
user8451312
There he goes...
 
alright
it's cabbage time
what's happening sixers
 
cbg \o
I'm currently digesting, so can't complain other than "I should've eaten less"
 
@DSM that precise skill is something that develops over time. FWIW there is a similar functionality in Spyder somewhere, but I can't find it now.
 
IDEs usually automatically trigger debugging when you set breakpoints
 
2:20 PM
yes
 
jjj
Hey, what are the possible reasons behind NotADirectoryError when using shutils.unpack_archive()? It is a problem with a specific file, it unpacks others.
 
user8451312
@DSM i found where is the problem, but i don't know why
 
DSM
Life is full of mystery and wonder.
 
I still don't know with certainty how the caramel gets in to the caramilk bar
I have my theories
 
Quantum Teleportation, common knowledge man
 
DSM
2:29 PM
There's no earthly way to do it. ♫ (spooky notes) ♫
 
user8451312
@Rawing have u seen this:

The len of tokens is 0 all the time after the filtering. And after spliting it is: 77, then 111, then 112, then 88, then 14... This is not from the start and this is not the end, cause it does this like a million thousand times, so i stopped it before it finished.
 
we need a theremin and a waterphone
 
DSM
@idjaw: do you remember those commercials, BTW?
 
@DSM oh yes. Very well.
 
2:34 PM
I have not
 
jjj
I like reading this chat, just a second ago I was ingorant of such thing as a caramilk bar
 
I need to find a new mystery now
 
jjj
Ups, sorry
 
people. find me a new mystery to solve
 
Javascript
solve that
 
2:34 PM
@hope94 I have. But I have no idea why that function is being called more than once, or why the list is empty afterwards. I don't think we have enough information about your problem to do anything more than guess what's causing it, so it's now your responsibility to figure out what's happening.
 
user8451312
@Rawing :( ok thank you.
 
@AndrasDeak thanks for mentioning pdb - I'd never seen it before :)
 
@toonarmycaptain I like it; it's not as effective as gdb --tui for debugging c/fortran, but it's a good start
 
@idja behaviour of gyroscopes, go!
 
I'm contemplating installing pudb which would be nice but the old DOS color scheme hurts my eyes
@toonarmycaptain that's very well understood actually :P
 
2:38 PM
@AndrasDeak I was not aware. Has something changed since '05 or something?
 
I'm trying to build a list using the output of enumerate with some fixed values inside each enumerate result tuple: [(a,b,c,d) for x[0],x[1],y,z in (enumerate(A, B), C, D)] -- what am I doing wrong here?
 
@toonarmycaptain maybe we're talking about different things
 
That is, a and b should be output of enumerate and c and d should be the same across all entries
 
@apsillers there's absolutely no correlation between your letters there
[k for elephant in potato]
10
 
oh jeez, wow, let me edit
 
2:40 PM
please do
 
DSM
I was wondering where the elephants were hiding!
 
It's true, your pseudo-code did more harm than good there. Explanation + input + output example would be best.
 
and the problem is that you want to loop over enumerate, meanwhile not looping over c and d values
for each fixed c and d you need a loop over the enumerate; if you have multiple enumerates and c,d values you need a double loop
 
oof, yeah, and now I've missed the edit window; very sorry -- let me take another crack at explaining
I see, okay
 
but yeah, a working example will be necessary for more detailed suggestions
 
2:43 PM
I wondered there was a way to do it with just one (and maybe there's some arcane Python builtin will do it) but perhaps a double loop is easiest
 
@AndrasDeak my understanding that behavior was well described and predictable, but that the underlying physics was not entirely settled, the "why".
 
Someone finally starred wim's duck type annotations. I thought I was the only one who found it funny.
 
@toonarmycaptain I'm not sure it gets any more settled than "Newton's laws"
maybe I'm unaware of some difficulty you have in mind
rigid-body mechanics are as well-defined as it gets in physics
unless there's some relativistic shenanigans, but those have more to do with relativity than gyroscopes
for instance, "how does a gyroscope precess near a black hole" is a difficult question mostly because relativity is hard
 
And of course, in formally specifying the problem, the solution just became obvious. Thanks for the rubber ducking @AndrasDeak @Rawing
 
Hi everyone, I have a flask app which uses a txt file as a DB (no need for a real DB as I only need to read one line at a time). I'd like to be able to update this text file and have it reflected automatically in my views/routes. I'm loading the contents of the file to memory just before I declare the routes (I basically instantiate a class that return its contents). What's the best way to achieve this without having to restart the whole application? FYI I'm running the app with uwsgi + nginx.
 
2:49 PM
Jul 27 at 23:42, by Andras Deak
quack
 
:D
 
@AndrasDeak I just remember hearing/reading about potential inertial propulsion systems using force precessed gyros, and had a couple of professors who were working on research to do with them, and had the impression that the prevailing thing was "we know what they do, but can't always explain why" - but maybe.
 
Well, knowing what it does and comprehending it are two different things. I know how a gyroscope precesses, yet turning with a bicycle is still magic.
 
@AndrasDeak there are some open questions, I believe, for gyroscopic motion of large masses, related to relativistic stuff.
 
relativity is tricky because already trivial things such as the model of a rigid body break down
 
2:59 PM
233
Q: How do I watch a file for changes?

Jon CageI have a log file being written by another process which I want to watch for changes. Each time a change occurs I'd like to read the new data in to do some processing on it. What's the best way to do this? I was hoping there'd be some sort of hook from the PyWin32 library. I've found the win32fi...

 
@AndrasDeak My default assumption is that Newtonian physics is just a pretty good back of the envelope approximation, which works most of the time, unless you need to be superaccurate, or use rather large/small contexts.
 

« first day (2504 days earlier)      last day (2448 days later) »