« first day (3589 days earlier)      last day (1342 days later) » 

1:10 AM
Hi everybody. Anybody has done Udacity Linked Lists quizzes recently. I am trying to solve a complicated subject.
Or anybody recommends a tutor online?
desperate to progress this project :0
 
 
1 hour later…
2:23 AM
@NYCRodriguez Linked Lists in Python? Why would someone be teaching this? - do you mean C++ or Java (in which case why ask in Python room)
I mean there is deque but most of the time with Python when you need a Linked List - you actually just need a List
 
2:46 AM
@LinkBerest Linked lists certainly were the main tool in the box for unbounded dynamic lists of things when working in C, but that's not all you can do with them. If you visualize them as directed graphs, then nodes and edges still make sense, even in Python.
 
@PaulMcG I mean with that course - I'm familar with the platform - I don't think it has a Python linked list section
As those courses really don't get into advance Python usage and focus on built-ins (you certainly can setup linked-list equivelent structures for linear graphs but Udemy doesn't go into this as far as I'm aware)
 
I wrote my own linked list Node class to brush up on graph algorithms before going in to an Amazon interview - it let me stay in Python so I could focus on the graph traversal bits. In retrospect I should have used networkx, and I would have picked up a new module in the bargain. (Amazon did not extend an offer.)
 
@PaulMcG Amazon did not want me either - though that lead to my current profession so this was for the best
 
"Cracking the Coding Interview" was actually a pretty good CS algorithm overview (I'd say "refresher" except that I never took a CS201 Algorithms course, being a mechanical engineering major, not CS). The first 10% of the book has the topics and questions, the remaining 90% are detailed descriptions of the "correct answers".
 
I like linked list in Java (they're awesome) so tend to see them overused in Python so tend to put them in the "metaclass" category ("If I'm using this - do I really need to" category)
@PaulMcG heh, I started in Electrical Engineering then CS moving to IS and finishing with MS in IS so understand that (luckily I got a hard-knock education as a backend developer and DBA due to my actual jobs :)
 
3:03 AM
I backed into some graph business in January - what else? writing a parser - and it really was interesting, even the small scratches I made at the surface. I should revisit and polish up that work. "Alga" is a language for graph manipulation, and it looked like a slam dunk to do a Python rendition using pyparsing. My ultimate challenge - could not decide among alternative syntax/implementation options.
 
I really need to actually publish a paper instead of all my working getting folded in to existing research / gov contracts- ah, one day
(to be fair - I'm fairly new to the academic side of this so this is not too surprising)
 
I sent a note to the original alga author, with some suggestions on how it might look in Python, but I think it was to abstruse - too tied to different Python implementation alternatives, and they were not Python savvy.
Maybe I should pose it to this room for some general discussion and see if we can collectively move it forward? Hmmm....
Well I really should get plusminus on track first though. And littletable. And pyparsing 3.0. Oh, and the day job.
 
i need help in how to deal with global var in jinja template

`
{% set prev = -1 %}
{%for j in range((a)| length)%}
{% if a[j]==0 %}
{% if prev == -1 %}
<p class="text-purple-700">{{a[j]}}</p>
{% else %}
<p class="text-green-800">{{a[j]}}</p>
{% set prev = 0 %}
{% endif%}
{% else %}
{% if prev ==-1 %}
<p class="text-red-700">{{a[j]}}</p>
{% elif prev==0 %}
<p class="text-teal-500">{{a[j]}}</p>
{% else %}
<p class="text-pink-800">{{a[j]}}</p>
{% endif%}
{% endif %}
{% set prev = a[j] %}
{% endfor %}
 
@LinkBerest If there is a local Python meetup or user group, they are always looking for speakers. Do 10 slides on something you are working on, or just discovered in Python. ("Why Would You Ever Use A Linked List in Python?" might be a good topic.)
 
@PaulMcG yeah, I done a similar speech for the PyLadies group we have here that I occasionally help with (its headed by one of the numpy contributors so is pretty cool) and I've used it in a lecture or two
However, its hard (in my area) to find advance Python users such that "use a List" isn't the best advice (this area is heavy Java and C++ but that is changing....)
 
3:16 AM
Who is the numpy person? and where are you located? There are a number of numpy folks here in Austin (Travis Oliphant and the former Enthought group)
@LinkBerest That is probably your Target Message for such a talk, and so appropriate for the not-so-advanced audience.
 
I'd have to look it up to be honest as I just started helping out and covid kinda messed up meetings (its a female contributor I remember - hence the group). I'm in Southwest FL
the lectures at least - I just need students to understand processing multiple data structures (JSON, CSV, text) to a graph of any sort at this point and the Linked List is basically - how does this thing from Java (you learned last semester) work in Python
 
@VaibhavkumarChaudhary I'm not a Jinja expert, but posting a code snippet this long (and with no formatting) won't get you much help in this room. See the room rules and formatting guide on how to ask in a way that is more likely to get helpful responses.
 
One of the fun parts of being a data engineer is the field is still new in a lot of ways and so there's a lot of building needed when developing courses to teach its concepts and principles (I love it mind you so that fun is actually fun to me but does mean more work and a lot of editing year to year)
 
Well, unearthing those hidden nuggets of data correlation from a mass of unstructured numbers is always a nice little Eureka! moment. In semiconductor world, there were many applications for multivariate analysis (usually PCA and Hotelling T²). I wrote my own (slow! pure Python) PCA routine to learn it better, but it was about 15 years ago so I'd have to brush up.
 
The reason why I need help is because of this: """The LinkedList code from before is provided below.
Add three functions to the LinkedList.
"get_position" returns the element at a certain position.
The "insert" function will add an element to a particular
spot in the list.
"delete" will delete the first element with that
particular value.
Then, use "Test Run" and "Submit" to run the test cases
at the bottom."""
 
3:29 AM
What programming language are you doing this work in?
 
I done it before but it does not work PYTHON Language
Yes I am a rookie Pythonese
 
I can work with you for about a half hour, but we'll take it to a separate room
 
Thanks ! Which room is that?
 
@PaulMcG writing a full PCA would have been a good choice back in the day (I had such trouble learning that at the time)
anyway, out for now - rbrb all
 
 
2 hours later…
5:52 AM
Is it bad flask code if I dont use WTForms for forms?
if I make my own html code and use request.form['value'] ?
 
6:22 AM
cbg
 
7:15 AM
Is there any way to write to a file faster? I don't know if it's written binary or ASCII and if i should change the way I write. Also, is there any differences between writing frequency and reading frequency? I have a sequence of numbers in a file and I would like to read them at the same frequency as I wrote them. How could I do?
 
What's the use-case that requires this?
You might be able to speed up writing if you remove some abstractions (e.g. manually formatting instead of a CSVWriter) but there is a limit to what the OS/FS can do.
There is nothing in a file that stores read/write frequency. Each operation will independently work "as fast as possible", which can mean practically everything depending on the environment.
 
7:54 AM
@MisterMiyagi do you think making a local database will help me speed up ?
Or maybe read in some kind of a buffer first , is this possible ?
like storing all the file content in a string ?
 
I'm lost. You asked about writing to a file, but apparently we've now moved on from that and are considering alternatives like databases? What exactly are you trying to do?
 
@Aran-Fey so: i am logging some values in real time from a joystick. (the steering values). And then I try to play a car movement from those values
but the curves are not the same, because the writing to file is faster that the reading from the file
 
Yeah, you can't just save the inputs, you have to save at which time each input happens
 
8:09 AM
can you tell me how should I do this :))?
 
And yes, definitely don't write the inputs to a file in real time, that's gonna slow you down
inputs = []
start = time.monotonic()

while True:
    buttons = get_inputs()
    now = time.monotonic()

    inputs.append((buttons, start-now))
basically
 
this is how to save the values
and how to playback them?
 
this is how to record them. No saving or playback included
 
@CătălinaSîrbu Do you actually have anything of this project in place already? It seems like you are trying to tackle one small detail without having made up your mind about the general design first.
 
so basically I have to detect some object in front of my car, and then I want to describe a curve in order to overtake the obstacle. And then, after some time, I want to describe another curve to come back in my lane
and I find this the simplest solution as I just need to go on the opposite lane, there I will be centering my car by other means, and then I also need to come back on my lane
 
8:17 AM
Detect an object? Are we going from recording inputs to computer vision now?
 
i asked for something very clear I don't understand what do you want from me :))
I asked how to read and write from file at the same freq
 
And how is the object detection related to that?
 
I just explained to you a little bit more in order to understand why exactly I need the same freq for example...
 
Hi there I have quite a tumbleweed question, Anybody care to chime in?
 
Ok. Start by recording inputs with timestamps, and then you can move on to worrying about saving it all to a file and playing it back later
 
8:21 AM
@Aran-Fey but you've shown me how to get the input. Can you also show me how to playback them , please?
 
@python_learner I almost never use them. Make of that what you will; whether that's considered good/bad practice
 
Well, I mean...
for buttons, delay in inputs:
    time.sleep(delay)
    press(buttons)
Does that help?
 
yes
thank you
 
@roganjosh I have visited your website earlier (a responsive website), so I am going to assume its "not bad" practice if you do so
 
8:38 AM
On that site, the only time I use WTForms is in the contact me form, just because it was the quickest way to get recaptcha working. But that can be implemented in HTML too
 
I was beginning to wonder as you stated Flask WTForms there, good to know where it was used, didnt know the source was on github, could help me on my flask
 
8:55 AM
@moshevi Note that this question looks like doing something one should not do, and definitely requires a deep dive into metaprogramming. Consider that this is just not an attractive ROI for what seems to be an XY problem. It would really help if you acknowledged the elephant in the room (that the ABC is inadequate) so that people are comfortable knowing their effort is not wasted.
 
@CătălinaSîrbu note that it takes two to communicate well. If the other party doesn't understand you have to try again (assuming you want to get an answer)
 
 
1 hour later…
10:37 AM
Closed, thanks
 
11:12 AM
yo
when using PF_PACKET in sockets,both s.send() and s.recv() can be used in single socket?
 
11:52 AM
@MisterMiyagi I concur: you absolutely have to override the abstract methods before ABCMeta will let you instantiate the class. The simplest way to achieve what you want would be to define a single "None" method and assign it to each o fthe abstract class names inside the definition.
The problem is that the metaclass is activated at class definition time, and statically examines the class structure using internal access methods that don't involve the class's __getattr__.
My suggestion may or may not work. I don't understand the real problem, and suspect @MisterMiyagi's declaration of an XY problem may be correct
@Janith That's pretty esoteric stuff. This post suggests it should be possible.
 
 
3 hours later…
user13036845
2:52 PM
@AndrasDeak Actually, the problem in the while loops is that whenever I type the integers like x and y a warning pops up. I know the solution to it (put int before them) but then the syntax error occurs. (also sorry for the super late reply)
 
There's no rush, directed replies give ample context
@BruceBanner you have to be more specific: what IDE you're using, what warnings pop up, what is the exact context in which warnings pop up, what language it's set to parse (hopefully python) etc.
as I probably said earlier: put together a small MCVE if you want to discuss specifics of code that doesn't work the way you'd expect it
 
3:43 PM
If an IDE warned me to use x: int = 1 instead of x = 1, I would immediately uninstall it
Tyrants can pry implicit typing from my cold dead hands
 
It should be linter's job
cbg
 
It's fine if I can opt in to type annotation warnings, but making it the default crosses the line in the sand
 
yeah, I refused to use linter until a coworker took the time to configure it properly
 
Andras might be on to something with his hint that the IDE might be expecting a language other than parsing. A warning that suggests to "put int before them" doesn't sound like it would lead to syntactically correct Python. Are there any languages where x = 1 and int x = 1 are both legal?
 
if there's an int x first then both are legal c
I find it more likely that there's user error interpreting the warning, hence my request for a warning
 
3:55 PM
Sensible.
I'm only speculating because I'm bored and my crystal ball needs to be run regularly. If I were keen to solve this as efficiently as possible, then I, too, would like a full MCVE
@Kevin I think you mean "a language other than Python"
 
that's how I read it
 
Wild guess: The actual problem is ValueError: expected int, got string on line reticulate_splines(x,y). Changing the line to reticulate_splines(int(x), int(y)) fixes it. The while loop is a red herring; the same error would occur even if you called reticulate_splines outside the loop.
 
this is next level debugging, boys
 
Obviously it would be silly to call it outside the loop, because, heh, can you imagine only calling reticulate_splines once? But it's possible in principle.
 
and what of the SyntaxError?
 
4:06 PM
Next level debugging will be in high demand once Mars is colonized and the code you're trying to fix is sitting on a server 1,000 light seconds from your location
If you think remote desktop connections feel sluggish now, try having a 33.3 minute round trip latency
@AndrasDeak Reply hazy, try again later
 
is that 33.3m right?
or just a guess
 
It's 1000 seconds times two divided by 60. I don't actually know whether Earth and Mars are 1000 light seconds apart in the worst case.
Earth is 500ish light seconds from the sun, so I figured it's a decent guess
 
yeah google says 22 light minutes
 
👍
 
and I was getting furious at ssh speed
 
4:20 PM
hi guys
when doing a scipy optimization like diff_evolution, why would I use the parameter args on the line that calls it, instead of just defining those constants on the scope of the function which executes the optimization? maybe I'm understanding something wrong here
 
If the constants are truly constant, then IMO you can keep them inside the function
 
@holdenweb I got answer ,I want to set reuseaddr. s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 
Nice one!
 
args is useful if your optimization function was already written to take arguments, and you can't be bothered to rewrite it to use constants
You often see that kind of pattern in all sorts of functional-style code, since it saves the programmer the hassle of writing kludgy lambdas just to get the right function signature
 
@PedroSpinola local name lookups are infinitesimally faster, and you don't have to worry about the nonlocal name being changed if it's passed as an argument
Or having to match names in the function's implementation
 
4:50 PM
I see guys! So, just to be sure regarding local lookups, code #2 should be much faster than code #1, right?
#code 1
def a():
	var = 0.33
	def b():
		return 5 * var * var
	b()
	return

#code 2
def a():
	var = 0.33
	def b(v):
		return 5 * v * v
	b(var)
	return
Of course I'd be running b() +million times
 
When I said "infinitesimally faster" I meant "barely but technically", so no, not "much faster"
 
faster, anyway, right?
nice to know!
 
In your real case the function doesn't do anything so maybe th difference would be measurable. In your real numerical problem this would be negligible.
 
I don't think there's much of a difference between lookup speed for local and closure variables
For global variables it's more significant, but still not a huge deal
 
@Aran-Fey could be; I only think of local vs global (and you're right, closure is neither)
 
4:53 PM
I have 0 global variables, all my code in inside a main function (if I understand scope right)
if var was outside def a it would be slower, alright
 
My interpretation is that you were asking about these two cases.
Basically "why would I bother using code 2 when I never intend to change the value of var?"
Augh these indents aren't playing nice
 
sry I'll use spaces next time
 
#code 1
def a():
    def b():
        var = 0.33
        return 5 * var * var
    b()

#code 2
def a():
    var = 0.33
    def b(v):
        return 5 * v * v
    b(0.33)
There we go.
 
I see. The only reasoon I'm defining var in the scope of a() is because for my real case I got a lot of different functions using var
 
Note that most of this is academic navel-gazing because you asked why one would use args in differential_evolution. If your code works without args use it without args
 
4:58 PM
I'll be back in 15min
 
For me, speed is a secondary concern here... I usually determine the scope of my variables based on their "intent" rather than trying to figure out the smallest scope I can use that still works.
(Although the two often coincide)
 
the caveat I mentioned about rebinding nonlocal names:
>>> def foo():
...     bar = 42
...     def baz():
...         return 2*bar
...     bar = 'oh no,'
...     return baz()

>>> foo()
'oh no,oh no,'
 
How do I put this... Although scopes are, strictly speaking, a syntactical construct, they can also convey semantic information about your business logic.
And ideally you'd choose your variable's scopes on the basis of semantics rather than syntax.
If this doesn't make sense, ignore me. I'm trying to articulate an idea that's closer to a gut feeling than anything concrete
 
5:59 PM
@MisterMiyagi I was simply asking a question, I didn't try to mislead anyone....
 
user13415013
6:16 PM
Hi guys
 
user13415013
Is there any way to use iter to iterate the functions
 
@Kevin makes sense to me. But maybe we at the same bit of cheese or undigested beef.
There's always a way
 
user13415013
I used iter to iterate over function, which doesnt works but, using string works, why?
 
@nerd I think you need a [mcve]
 
user13415013
Here is snippet i used ,
activations = ("a","b")
act_iter = iter(activations)
next(act_iter)

which works and prints ('a','b')
 
user13415013
6:19 PM
but when i used functions, it didnt work,
 
user13415013
activations = (F.relu, F.relu)
act_iter = iter(activations)
next(act_iter)

which dont give functions but give number (4,4)
 
then F.relu is a number
>>> class F:
...  def relu(self):
...   ...
...
>>> activations = (F.relu, F.relu)
>>> act_iter = iter(activations)
>>> next(act_iter)
<function F.relu at 0x104339cb0>
Could be a property, of course
but
>>> class F:
...  @property
...  def relu(self):
...   return 4
...
>>> activations = (F.relu, F.relu)
>>> act_iter = iter(activations)
>>> next(act_iter)
<property object at 0x10432bd70>
>>> f = F()
>>> activations = (f.relu, f.relu)
>>> act_iter = iter(activations)
>>> next(act_iter)
4
(so, you're missing the "complete" part of MCVE)
 
user13415013
Thank you.
I am thinking how my code

import torch.nn.functional as F
F.relu() changed into int.

code gone crazy.
 
F.relu() != F.relu
 
that ^
 
6:28 PM
(I mean, it could... but... it probably doesn't)
>>> class F:
...  @classmethod
...  def relu(cls):
...   return cls.relu
...
>>> F.relu() == F.relu
True
But... don't do that.
 
@WayneWerner the most pointless of functions :D
 
user13415013
Im feeling so crazy, how this could happen, my python gone crazy
 
@AndrasDeak Very (:
 
dpaste.org/zO98 can someone help me resolve this circular import?
 
@nerd MCVE. I can almost guarantee, that if print(type(F.relu), repr(F.relu)) gives you <class 'int'> 4 that somewhere you have written something.relu = 4, or equivalent
 
6:32 PM
@nerd did you actually check the parentheses?
hint: it's never python gone crazy
 
^^^^^
computers do exactly what you tell them to do, even if you didn't mean it
 
@VisheshMangla I don't see imports nor circularness: GeneralFormModel only needs QuestionForm after instantiation
your MCVE might be too minimal
 
not complete enough (:
seems to be going around :P
rbrb, food time
 
@WayneWerner have a good one
 
user13415013
@WayneWerner, I was replicating F.relu function for five times using this
[F.relu for a in range(1,5)] and this was crazy.
 
6:36 PM
@nerd you'll have to give up and tell us what on earth F is
 
ah right, linter was showing error and I though it was counted in circular imports. Thanks @AndrasDeak
 
@VisheshMangla well the error/warning can probably tell you more
it might notice circular imports but linters by definition only do static code analysis
 
user13415013
@AndrasDeak, It is functional library as import torch.nn.functional as F .
 
@nerd OK, so F.relu should indeed be a proper function, no property or OOP trickery. The only explanation is that you accidentally called the function.
 
yeah, that's y we write tests
 
6:39 PM
Either that or you shadowed F or F.relu... but that's less lkely
@VisheshMangla also why we run our code to see if there's a circular import ;)
those are very loud errors
 
yep, right. I have to remove fear of red lines
 
red lines are a strong hint though :P
 
user13415013
yes @AndrasDeak, I was wanting to use for loop in single line to get 5 list of F.relu , and implemented [F.relu for a in range(1,5)], which , wildly overwrited my function as int
 
@nerd that cannot overwrite your function as int
[a for F.relu in range(1, 5)] on the other hand, can
 
ah yes, that
 
6:42 PM
So, unsurprisingly, you haven't showed us the code that produces your actual problem.
 
user13415013
but suprisingly, I hadnt ever written F.relu to int but after i restarted kernel and write same code it worked
activations = [F.relu, F.relu, F.relu, F.relu, F.relu]
act_iter = iter(activations) if activations is not None else [F.relu for a in range(1,5)]
next(act_iter)
 
user13415013
giving <function torch.nn.functional.relu(input, inplace=False)>, which i want.
 
user13415013
problem solved, sorry guys if wasted time in illogical problem . Bye .
 
Anyone knows what's wrong with this? bpa.st/GBOA
I've installed all requirements.txt but it still says something is missing.
 
user13415013
@Zeta.Investigator , you use theano even today.
 
6:50 PM
@nerd Trying to build this github.com/nbrasher/covid-model
 
user13415013
cool, does it have given weights of their model, i found no where
 
@nerd Idk. I just want to run the main.py file! But I'm getting that weird error. Do you know why?
 
user13415013
Im so sorry @Zeta.Investigator, i know nothing about theano.
 
user13415013
It might be good if you question giving tag on Tensorflow teams, some would solve it. or try to give issue in github link.
 
user13415013
Just 5 6 hours ago i was searching here for some computer vision expert for these kind of question.
 
user13415013
7:02 PM
ok good night guys.
 
7:43 PM
github.com/Theano/Theano/issues/5857 looks relevant. Apparently you need "the development version of Python, including the shared libraries"
 
8:26 PM
Hi
i'm new to SO chat
what courses with certificates would you recommend for python AI?
 
@Speedy Welcome :)
 
@roganjosh thank you
 
@Speedy I'm going to be a bit pessimistic, though, I'm afraid. I'm not sure that the online courses are respected very much and there's been a flood of people doing them
 
@roganjosh no worries, i like reality over optimism, that's what i thought too tbh
 
To the best of my knowledge, Andrew Ng's course called Machine Learning is relatively respected, but it appears that it's on multiple sites now
 
8:37 PM
oh ok cool, i'll check it out
 
But it's unlikely to differentiate you from the rest of the people that managed to find the "hot sale" when it's reduced from like £1500 to £12 every week
 
yeah, i live in a country too where i don't think we have jobs in python, i just wanted to learn and possibly get a remote job
 
In fact, I think that one's free. My personal opinion is that you would be better doing some structured learning and then go completely off the beaten track and start working on your own projects. That shows a genuine interest in the topic. And if it doesn't, make some robots to go round to the offices and threaten the recruiters. Win win
 
it's insane how university prestigious courses cost as much as udemy ones nowadays xD
hell yeah, HR is always fun to talk to
 
Satire, I like it :)
 
8:44 PM
they are not as bad as the american ones here but we still have a fair amount
i started python a 3 months ago, my projects envolve selenium bots and automation
i want to try and step up a bit from the generic bots
 

« first day (3589 days earlier)      last day (1342 days later) »