« first day (3683 days earlier)      last day (1266 days later) » 

12:38 AM
is it possible that to make python run directly in the browser like js
 
12:50 AM
Yeah, many ways to do it, although usually people want something like django
 
 
5 hours later…
5:45 AM
cbg
 
 
2 hours later…
7:46 AM
cbg
 
Excuse the off-topic but hi I came on here cause I am also Andy K, it is nice to meet
 
8:23 AM
cbg guys
 
@TheLittleNaruto cbg
 
>>> import re
>>> st = "#123428: SOME External Communication\
... #128135: SOME External Communication "
>>> res = [str(i)[1:str(i).index(":")] for i in re.finditer(r"#(\d)+:", st)]
>>> print(res)
["re.Match object; span=(0, 8), match='#973428", "re.Match object; span=(79, 87), match='#968135"]
Any idea why this "res" array is not getting rid of "#" at the start?
Is there anything wrong with the lambda expression?
does it have to do anything with re.Match object?
 
8:39 AM
the match object covers everything that led to the match. you want only the group
 
SO in my case it would be i.group()
right?
 
@TheLittleNaruto what lambda?
 
and you probably want the group to cover several digits, not to repeat the group for each digit
res = [i.group(1) for i in re.finditer(r"#(\d+):", st)]
 
@AndrasDeak Isn't that "lambda expression" way of getting a new set of array out of another array?
@MisterMiyagi So group() will return only one digit?
 
@TheLittleNaruto group will return only one group
your initial RE defined that group to be one digit long
 
8:45 AM
I see
 
compare your r"#(\d)+:" versus my r"#(\d+):"
 
Ok let me check
>>> res = [i.group(1) for i in re.finditer(r"#(\d)+:", st)]
>>> print(res)
['8', '5']
 
@TheLittleNaruto no. They are lists and it's called a list comprehension.
 
@AndrasDeak TIL! Thanks.
 
Lambdas typically have the keyword lambda in them
 
8:48 AM
So it returns the last digits from each group of digits. if I use r"#(\d)+:" @MisterMiyagi Thanks this is pretty clear now.
 
Lambdas are anonymous functions
 
Python is different than Java or Kotlin
 
@TheLittleNaruto Yes it is.
 
@TheLittleNaruto is that news?
 
@AndrasDeak :D
How are you doing?
 
8:56 AM
Fine, thanks. And you?
 
All good here. Thanks
 
9:14 AM
For the first time I am here Wanna welcome me ?
 
Welcome to rooms/6!
 
Whoever gave me 31 upvotes overnight: you are only wasting your time. These votes will be reversed, and it's not cool to serially vote on users.
 
May be a big fan of you.
 
if they hate me they are doing it very wrong
 
Maybe they clicked the wrong button 31 times.
 
9:24 AM
Possible, although unlikely :)
 
"Proxy is detected" I am trying to scrape a website with scrapy and I am facing this issue. I have installed scrapy-proxy-pool. Help please.
There are some other outputs as well that might help :raceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/home/bingo/virtual_env/lib/python3.8/site-packages/scrapy/core/downloader/middleware.py", line 55, in process_response
    response = yield deferred_from_coro(method(request=request, response=response, spider=spider))
  File "/home/bingo/virtual_env/lib/python3.8/site-packages/scrapy_proxy_pool/middlewares.py", line 287, in process_response
Or am I in the right room ?
 
@KamrulHasan yes, this is the right room, the python room
 
Okay, Thank you.
 
It's surprising to me that every line in the traceback seems to be library code rather than your code
 
9:37 AM
looks like it fails in a twisted callback.
the source of that callback isn't visible, sadly.
 
ah, I see
async shenanigans
 
Erm, I don't think you need scrapy when the page already provides JSON
 
Maybe but you know I am beginner. let me try and export as .csv
 
Either way, please take a look at the code formatting guide. Debugging Python code without indentation is generally not meaningful.
@KamrulHasan Well, that's why it would probably be a good idea to use the simplest framework adequate for your task.
 
Sorry for repetition
 
9:45 AM
Be aware that you can edit and delete your messages up to 2 minutes after posting them.
 
Sadly! I don't find edit edit or delete options
 
It will help if you get yourself acquainted with the room rules before posting any further code.
 
Okay. Thank you.
 
@KamrulHasan in particular, that's both too much code and it's not formatted well. Please post it in a code paste service and link here.
 
10:11 AM
@AndrasDeak nice to see those numbers though, right? :P
Even though the system will soon taketh away
 
10:27 AM
@BožoStojković the favicons just disappeared, triggering the alarm :P
 
Heh, that ~10% of tabs I can't really account for is always fun. One was a wikipedia article on Num Lock because, in frustration, I searched "why does num lock exist?" which, apparently, seems to be resonably-well searched
 
Well, there are a few functions to it, I guess. I'm more interested in why scroll lock is a thing.
 
I don't think I have a scroll lock button
Also, num lock never has any use to me other than to annoy me that my number pad seems to just disable itself all the time
 
@BožoStojković that's going back a bit... can't remember when I last saw scroll lock on a keyboard :)
 
10:38 AM
@roganjosh Oh right, I was thinking of the usage of numpad, as opposed to that of num lock. Don't know why lol. I agree 100%
@JonClements I have it and sometimes it's turned on for no reason.
 
@JonClements I think I can remember seeing it on an old Tandy keyboard in the back of my mind :)
 
wow... Tandy's... that's a memory... :p
 
We ditched the Tandy when we go a computer with an LCD display showing the clock speed at 133 MHz. To this day I don't know why that was a thing because I don't recall it showing anything other than 133, or what it was supposed to convey to me :P
 
lol... did you have one of those computers with a "turbo boost" button thing...
 
YES!
It was that computer. Maybe that's why it displayed it... I could boost it to 166 MHz or something. That's jogging my memory now :D
 
10:54 AM
I feel like we're in a pub scene after a few too many pints and doing a "do you remember when..." moment :p
 
You say that like it's a bad thing
 
not at all... 133 mhz hey... was that a "pentium" or pre "pentium"... 133 rings a bell for being a 486 DX jobby
 
It's definitely a pentium
Yep - here
 
ahhh okies... fairly sure you could get 133/166 from a DX though... didn't think the pentium supported speed shifting
I stand corrected... it did it seems... wow...
 
I'm not sure if I've ever used something other than, ultimately, pentiums. In which case, it might be my memory blurring
Ah, ok :)
 
11:02 AM
Hey, I remember there was a builtin function for python that basically let u convert an array to another array of tuples containing its index and value. But I forgot the name of it. Does anyone know?
 
What do you mean by "array" here? That's not me being pedantic, it has a pretty distinct meaning from "list"
 
Oh sorry I meant list
 
@Dsafds enumerate?
 
@roganjosh think I was confusing it with my memory of en.wikipedia.org/wiki/Intel_80486 - appears that was 33/66 and not 133/166 etc... meh...
 
In which case, I don't know of any builtin function for that. You can use a combination of different things
 
11:05 AM
Jesus the stackoverflow ping jumpscared the sh*t out of me
 
Wait a second. Is that you, Amanuel?
 
Yeah, do I know you?
 
@JonClements 50 Mhz? Pfft, get outta town <proudly displays my 133 Mhz LCD>
 
I had a nickname Slayther few years back
 
Oh! I think I remember you how are you?
 
11:06 AM
Doing well I suppose :) How about you?
 
Doing sorta well I suppose xd. Currently looking for internships haha
 
Good to hear. I am thinking about doing internships as well. But I'm not sure about it currently.
 
@roganjosh I'll take your 133 and raise it another 3 odd thousand... although the LCD has to be the winner here :p
 
I mean, this laptop has an i7 but it doesn't display its clock speed anywhere and it doesn't light up in blue. How am I supposed to know whether it's slacking?
 
conspiracy theory... while we're told we've got decent cpu speeds we're still really on 133mhz and they removed the lcd jobby so we don't notice? :p
 
11:17 AM
It's not even a conspiracy theory, there's some factual basis. 1 sec
It was the basis of my question here
I link that because you should be able to copy/paste and run the test code. I haven't actually checked it in Windows 10 (I'll do that today) but Windows borks the CPU speed as it sees fit
 
can anyone explain me how the following two lines is used for clearing a challenge? essentially create nested structures like so [], [[]], [[[]]]
puzzle = []
puzzle.append(puzzle)
this was in the top rated solutions, surprisingly
if needed I can paste what is given as a comment, but I still dont understand
 
11:33 AM
I don't know what "clear the solution" means. Is there some state between runs on the platform?
 
sorry roganjosh, wdym?
 
No, wdym :P "used for clearing a challenge" I think I've misread as resetting your problem between multiple submissions, but I think you mean it as in "passing a test"
In either case, I don't understand enough of the context. Can you link the challenge?
 
yeah, it clears all tests
sure one sec
 
"clears" or "passes"?
 
yeah passes as in "this test is cleared", bad language sorry
I wrote a recursive solution so my code worked fine, I was just browsing the solutions to know a better way
 
11:38 AM
@python_learner I recommend puzzle = puzzle[0] = [...] to adequately express the mind bend.
It's the closes Python gets to truly recursive data structures as one might use in functional languages.
recursive defaultdict might work as well.
 
puzzle = puzzle[0] = [...] is this supposed to work? I got SyntaxError
 
don't use Python2
 
thanks, I really need to alias python, works
 
just resist the urge to save typing one character. python3 always does the right thing.
 
laurel, I previously had anaconda and python took me to python3, I didnt do any aliasing afaik, now I switched to brew and I am not used to typing that :[
 
11:45 AM
@MisterMiyagi heh, that's just made me super-confused so I guess the puzzle works on some level :)
 
two unique solutions aside, what is this called so I can google this? I vaguely remember the ellipsis situation being spoken in this chat room though
 
@python_learner use a virtualenv
 
thats nice advice, I only use virtualenv to test a new library that I am lazy to uninstall later :D
 
@python_learner I don't think there is any name for it. One could call it a "recursive data structure", but that's going out of the way to give it a name.
It's really just that "lists can contain things", and "lists are things", so there is no problem for a list to contain itself.
 
kinda like a cyclic graph then?
 
11:55 AM
Trying to think of that as some magical special case is likely to just add confusing cargo cult.
 
@MisterMiyagi kind of defies "but lists are really arrays" angle. Yeah, I know, array of pointers. Still.
 
@AndrasDeak I'd say that lists are implemented as arrays (of pointers), but they are not arrays.
@python_learner Exactly like a cyclic graph.
 
Good, I always chide people for calling them arrays
 
Keep fighting the good fight and chide on!
Chiding the good chide?
 
What is Ellipsis doing here to support this?
Looking at answers, do I need to be looking at __getitem__ of lists?
 
12:07 PM
The Ellipsis is just a smokescreen. You could write any value in its place.
It's the multiple assignment that does the trick.
Compare puzzle = puzzle[0] = ["This is just here to define element 0"] and puzzle = puzzle[0] = []
 
and other fun stuff like: x = a, b, c = [1, 2, 3]...
 
in CHATLAB and Talktave, Oct 17 at 11:59, by Andras Deak
> An assignment statement evaluates the expression list (remember that this can be a single expression or a comma-separated list, the latter yielding a tuple) and assigns the single resulting object to each of the target lists, from left to right.
Context and elaboration therein
@roganjosh not really, it's silly
 
@AndrasDeak The expression ist can also be a list, can it not?
 
Sure, I was also being silly. I mean, that pushes you over the daily rep limit anyway!
 
>>> x = [a, b, c] = range(3)
>>> x
range(0, 3)
>>> a, b, c
(0, 1, 2)
 
12:15 PM
@holdenweb yeah, so?
 
Just adding for completeness.
 
In what you showed the expression list is a range, not a list
the list is a target list, which happens to involve unpacking after
 
x = [a, b, c] = range(3) makes sense to me. The Ellipsis was a surprisingly good smokescreen, at least to me
 
@AndrasDeak You're right.
 
and the target list can also be a tuple :)
 
12:21 PM
Seeing [] on the LHS always feels super weird to me. I can accept () doing all sorts of crazy stuff, but [] is supposed to make a list, dammit!
 
in MATLAB [a, b, c] = f() is mandatory
 
>>> x = [a, b,c] = iter(range(3))
>>> x
<range_iterator object at 0x7fa989af0e40>
>>> next(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
If the assignments don't exhaust the iterator the interpreter raises ValueError: too many values to unpack (expected 3)
 
 
1 hour later…
1:33 PM
Is it possible to have for one python program one console for input and one for output? Or is there a better way to have output and input simultaneously?
 
"console"? On Linux, normally a program has standard input, standard output and standard error. They are inherited from the parent process unless a specific redirection is made. When you run a program from the command line, all three are normally associated with the command line window (terminal emulator).
Input and output can be freely mixed on those channels.
 
Then how to make a "redirection"?
 
 
1 hour later…
2:56 PM
redirection to what? i think you need to start by explaining what your end goal is, not some xy question..
 
 
2 hours later…
4:56 PM
cbg
 
5:39 PM
Hi, Can I share a question that I posted here at stackoverflow ? Early in the morning I asked the same question here at the chat room but I could not make it clear.
 
you can post questions that are at least 48 hours old
 
Okay Thank you.
 
np, you can check the room rules to know why that is the case
 
I got it
Building wheels for collected packages: PyDispatcher, protego, Twisted
  Building wheel for PyDispatcher (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/bingo/virtual/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7049tmva/PyDispatcher/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7049tmva/PyDispatcher/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kkvf2w60
I get this when I run "pip3 install scrapy_proxy_pool"
How to solve this issue ?
I am on python3-venv
 
bdist_wheel needs the wheel package I think
 
5:54 PM
this error happen when I create a virtual environment and run "pip3 install scrapy_proxy_pool" for the first time but if i run the command for the second time I get "Requirement already satisfied"
 
Yeah, it seems it tries to build wheels first, which it can't because there's no wheel package installed, so then it installs the packages from source(?).
This is all you need: Successfully installed Automat-20.2.0 BeautifulSoup4-4.9.3 PyDispatcher-2.0.5 ...
You can try starting a new venv, installing wheel first and then installing these. It should build the wheels successfully first.
 
Thank you this time I did not get any error.
 
6:25 PM
Does anyone knows how to fix VLC in pyqt5
 
 
2 hours later…
8:12 PM
hi. I am trying to understand some standard tensorflow code. E.g. bpa.st/ZVXA I am completely new to tensorflow and don't understand how the GRU line, for example fits with the manual at tensorflow.org/api_docs/python/tf/keras/layers/GRU
rnn_units = 1024 in my case. Which setting for tf.keras.layers.GRU has been set to 1024? It doesn't have a keyword
I think I got it
 
9:12 PM
Why has someone starred a giant traceback?
Please see the room rules @KamrulHasan. It's fine (and often helpful) to include a traceback, but not as a post in the room. Please use an off-site resource and link back to it
 

« first day (3683 days earlier)      last day (1266 days later) »