« first day (2923 days earlier)      last day (2011 days later) » 

4:00 PM
i has i feeling it was to do with signature. i just want the function to treat the array as 2D and the vector elements as whole objects rather than breaking them down further
 
What "the array" and "vector elements"?
the function only gets either
test = numpy.vectorize(test, signature='(m),(m)->()')
this will make it so that you get 3-length vectors passed to the function in the 3d case, but also in the 2d case ^
 
i think that should work
the 2d case is purely a lower dimension test case
all uses will be in 3D
 
if the return value is not a scalar then that part of the signature should be changed of course
@Flemingjp but if you start working with it and it's slow, do consider vectorizing right
 
could you explain the signature to me?
 
@Flemingjp yup, it says "assume a one-index array as first arg, a one-index array with same size as the second arg, and return a zero-index array (scalar)"
 
4:03 PM
sounds good, ill give that a go! Thank you
it should beat my current code - two nested lambda functions yuk!
 
so when numpy sees that you're calling a function with arrays of shape (3,3) it will call the function three times, with arr[0,:], arr[1,:] and arr[2,:]; in the 3d case (3,3,3) gets called 3*3 times, etc.
@Flemingjp you should probably use full functions instead of lambdas for readability
and no worries, have fun with it
but most physics you mentioned should be vectorizable easily
just write out your formulae and introduce additional indices for the array dimensions
 
I essential have a matrix W to find
 
like, your 3-length vectors are really arrays with 3 indices, and the first two indices can vary (and the last index gives you the 3-dimensional inner space)
 
with elements W(I, J, K)
where (I, J, K) = state_i + state_j
 
you're a physics student; part of what we do is figuring out how to write and handle such indexed expressions :P
start on paper, end up with a result that has all three indices, then implement
you'll almost never want to use np.vectorize (either loop, or vectorize properly)
 
4:06 PM
Ill have a go :) it will be the best way forward
 
have fun
 
Can you write to a variable within a file ?
 
I'm not sure what you're asking but probably not
 
Hello everybody,
is it allowed to discuss regex here?
I know this is python room but regex is also used in python so wondering if regex can be discussed here
 
/gasps ... /hides in corner to avoid being seen by regex police
 
4:18 PM
cbg
Why do I always walk in to someone asking if they can ask a question? @SpringLearner please ask away.
 
well at least this is a question about asking an off-topic question
 
I am just a beginner and practicing regex
 
I'd think the regex room is great for regex questions chat.stackoverflow.com/rooms/info/25767/…
 
A regex to test only the words with abc,def,ghi and jkx
I did the like
[abc][def][ghi][jkx]
 
regex101.com is also a very good experimentation site
 
4:21 PM
but it does not work
 
Dude you just posted this in the java chat too <_<
 
"does not work"
 
@ballBreaker yes, they are not active now
 
We won't help you until you come up with a complete problem statement. What you think it should match but doesn't. And if it ends up being language-specific and it doesn't appear in python, I'll be cross
I'm somewhat surprised that someone with 11k rep will post literally the same question to three separate rooms without waiting a decent time to see if they get an answer. Not very considerate
 
@AndrasDeak oh snap
 
4:26 PM
java room wont be active untill tommorow
regex room is dead
and so asked here
That was exactly question asked in interview
 
why are they asking you regex questions on an interview?
 
a-ha :D
 
interview can be anything, just to check the talent of a candidate
 
I guess
 
4:30 PM
Your regex is correct for all 4-letter words composed of "abc" in the first position, "def" in the second position, and so on.
So would match "adix" (not tested)
 
Thanks paul, then I think my regex wont work if order is changed
 
9 mins ago, by Andras Deak
We won't help you until you come up with a complete problem statement. What you think it should match but doesn't. And if it ends up being language-specific and it doesn't appear in python, I'll be cross
 
That was not part of your original question
 
still waiting for an answerable question
 
rbrb for lunch
 
4:34 PM
@AndrasDeak test case 123.456.abc.def
expected output true
my output false
 
yup
 
I don't get it. Is the regex supposed to check that each character in the string only occurs once?
 
14 mins ago, by SpringLearner
A regex to test only the words with abc,def,ghi and jkx
I did the like
 
@PaulMcG you are correct, I am sorry for that. After your statement, I noticed that
 
I don't see how that should be "true" with that example. As I said, your problem is ill-posed. Try making it definitive.
 
4:36 PM
I will add screenshots if it does not violate room rules
 
How much time have you spent trying to learn using regular expressions?
the rules are here
because your suggested regex for that kind of pattern (whatever the actual objective) is way off the mark, and we don't have the capacity to teach you regex from scratch
we can help with specific issues you run into
 
No no, I dont want you all to teach me, just wanted why is the issue?
 
The issue is that [abc] defines a character class, google that. And [abc][def][ghi] will match three characters belonging to those character classes each.
 
i'm really in no place to say this because i'm pretty bad at most programming but if you here about an interview question is that job really for you?
 
4:39 PM
Wow, that screenshot really clarified the problem statement
 
@johnsmith that's why I asked why they were asked a regex question, but if you think about it there are no "regex jobs"
 
the fonts are of small size because I wanted to capture the question+test cases in a single image
 
Are you working on the interview as we speak?
 
or is that just a regex test website you found?
@SpringLearner then please go learn about regular expressions. If you pass the test because we help you, how will you perform your job?
 
4:42 PM
its a just a begineer interview
there are 5 different levels
when human involves, I will clearly say does not knowledge in regex
 
There can be interviews, homeworks, assignments. These are all designed to test your knowledge. Which seems lacking, which you have to fix by learning.
you could have learned 3/4 of what you need during the time you spent trying to explain what you need to do to others
 
ohh man, I never asked do it for me , I just wanted to know where is the mistake. If you scroll up and check , I never said do it.
 
and I told you what's wrong
regex101 would probably also tell you what's wrong
 
before I posted question, I went regex101 also, regex101.com/r/0Ulcgr/1
but It is does not explain where is the mistake
 
the top right box explains in clear terms what your regex is doing
 
4:49 PM
I sympathize with my fictitious friend who has worked hard to learn regex and is going for the same job.
 
@SpringLearner what is the output you're looking for?
 
@SpringLearner this link is as much as I'd be willing to offer in terms of help regular-expressions.info/alternation.html
 
15 mins ago, by Aran-Fey
Wow, that screenshot really clarified the problem statement
 
@piRSquared thanks
I apprciate your help
 
5:03 PM
2 weeks later...

Me: Hey Friend Bill!
Bill: Hi Pir )-:
Me: OHNOES! Why the sad face, Bill?
Bill: I just got laid off from the regex factory.
Me: Why!?
Bill: They just hired someone who to replace me who doesn't even know regex.
 
now, now
 
A fair criticism would be to ask why they were looking to replace Bill in the first place
 
Who needs to know regex when you can just ask for it on SO?! /s
 
what is the daily production of regexes from that factory?
 
Don't know the exact amount, but it should approximately match r'\d+'
 
5:06 PM
Bill's production was very high. He used a random-character-generator. However, they rarely passed quality control
 
@shad0w_wa1k3r you are correct, In 3 years of experience, I never used regex in java,or angular or SQL. I was using only in notepad++ to replace a string and that too without regex is also possible in terms of duration
 
I've used it extensively, to say the least, in my ~5 years. URLs, scraping and what not.
It's good, if you know it.
 
you are correct
just for fun, I was using regex in notepad++
 
Regex is like something that once you learn you wonder how you ever did without
 
In my 20 years of experience doing whatever it is I've been doing, I've never used regex in production code but I don't know what I'd have done without it.
 
5:10 PM
It's like learning to use a text editor, like vim or something
I use sed all the time
 
@malan in your opinion whats the best text editor i use Sublime text
 
@johnsmith vim
 
what do you like about it
 
@johnsmith The whole never-lift-a-finger thing. Once you get used to the keybindings you never really feel normal editing anywhere else. I still press <esc> while I'm typing on StackOverflow and even in emails in Outlook. I imagine emacs might be excellent, too, but I've never tried it.
 
@malan interesting, it reminds me of a cmd prompt
like just the default layout
 
5:26 PM
@malan part of that is "omg let's use regex for everything" even when it's not optimal :P
 
does zip(*[[0, 1], [2, 3]]) work in legacy python?
 
Python 2.4.3 (#1, Jan  9 2013, 06:47:03)
>>> zip(*[[0, 1], [2, 3]])
[(0, 2), (1, 3)]
 
thx
 
@SpringLearner what's the exact requirement?
if you are still looking for a solution that is
 
they aren't
nudge nudge wink wink
 
5:33 PM
all good then :)
 
wim
what is "legacy python"?
 
pythoff
 
good one xD
 
As old as pythoff though
 
wim
5:46 PM
2.7.x released as recently as 2018-05-01, hardly legacy
 
> Short version: Python 2.x is legacy, Python 3.x is the present and future of the language
We have an official word on that
 
wim
I have a different understand of legacy
for me it's something along the lines of "code still in use, but will not be maintained/changed"
 
Isn't python 2 pretty much that by now?
 
2020 can't come soon enough
 
it was meant to become legacy with python 3, it just didn't exactly unfold as planned
 
wim
5:50 PM
@AndrasDeak No, it's still maintained for a year at least
And I predict that google or some other heavily invested player might even take up the maintenance after 2020
 
The language yes; python 2 code no. I mean officially everyone should've stopped developing python 2 code when 3 came, right?
 
wim
no way
 
I use it as a pejorative term to facilitate the move away from the use of pythoff
 
I know there was a huge brouhaha when 3 came when none of the dependencies were ported, and everyone blamed someone else for not changing. But it seems to me that the maintainers intended the switch to be a painful but sudden (rather than painful and extended) ordeal
 
wim
@piRSquared aha.
sorry, missed that.
Just released a pytest-structlog plugin to PyPI.
check it out, if you're interested in structured logging + testing
 
6:07 PM
is structlog the "write your logs for computers, not for humans" thing?
 
6:31 PM
Trivia quiz inspired a question from this morning: What's the output of the following code?
__var = 'option 1'
_Cls__var = 'option 2'

class Cls:
    __var = 'option 3'

    def test(self):
        return __var

print(Cls().test())
 
definitely not the mangled version
 
:D
 
Yay, guessed correctly
 
post-lunch recbg
 
afternoon cabbage
 
6:53 PM
I look at that and immediately think option 3 but obviously that's wrong
 
option 3 is by far the wrongest :P
 
@W.Dodge Well, that leaves 2 to choose from :P
 
definitely didn't have to drop into an interpreter and find out, cough
 
Just in case someone doesn't have access to an interpreter: Solution
 
6:58 PM
The wrongest... lol, thanks vaultah :)
 
@vaultah I would say 'option 4' is the wrongestest
 
@Aran-Fey also tio.run/…
 
it's even wronger than NameError
 
Explain so i can have an ‘ah ha’ moment
 
@vash_the_stampede Do you know about python's name mangling?
 
7:02 PM
Nope
 
> Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped. This mangling is done without regard to the syntactic position of the identifier, as long as it occurs within the definition of a class.
 
it's so you can specify a member as "private," or at least near as you can do in Python
 
also must learn the meaning of 'private' in this context
 
So you are saying that calling the method of that class basically returns _Cls__var and that the print call is simply receiving _Cls__var. So, as a result, prints option 2 ?
 
Plumbing, versus porcelain
except slightly more strongly so
 
7:06 PM
@W.Dodge Yep
 
@W.Dodge yeah
 
Coolness
 
so YourClass.foo might be a method that internally calls YourClass._fooer (the single leading underscore is an idiom that means "this isn't part of the API for this function, so don't use it please.)
and _fooer itself may need to access some variable that really shouldn't be being mucked with that would be named __the_fooee or something.
 
@vaultah ty and all understood
 
Final tally: vaultah 1, everyone else 0 (including me)
 
7:08 PM
the double underscore being merely a more forceful way to say "Hey, this isn't meant for you to muck with."
 
@Aran-Fey I think I get -1
 
But it also means that doing things in most debuggers like print (some_object.__interesting_var) will fail (can only write that within the class context of type(some_object).
 
what are some necessary applications of this
 
necessary? I'm not sure I've written any necessary code in my life.
 
@AndrasDeak Fortunately for you, we use a binary system for scoring (:
 
7:08 PM
bad wording
 
so why is that method not "within the class context"?
 
lets try what are some applicable uses of this
 
Same idea as private in Java or C++ - not visible to external classes or even derived classes
 
@vash_the_stampede it's primarily intended to be a mechanism to stop internal names defined in a subclass to interfere with the attributes of a parent class, or something along these lines
 
@AndrasDeak I jus took two steps backwards reading that
 
7:10 PM
class YourClass(self):
    def __init__(self, readonly):
        self._readonly = readonly

    @property
    def readonly(self):
        return self._readonly
@vash_the_stampede I'm only joking :). Imagine a read-only attribute implemented with property like:
 
you can define an internally used method named __frobnicate without having to worry about other classes in the mro defining their own frobnicates
 
I'm off to lunch though -- rbrb
 
@AdamSmith should be double underscores __readonly correct?
 
read the rest of his messages; he's also talking about _sort_of_private attributes
 
just did that excuse my brain its ability to process new information is slightly hindered right now
 
7:54 PM
recbg
 
wim
@AndrasDeak yes
 
sounds good
 
wim
in dev: log human readable to stderr
in prod: log json serialized events to stdout
 
8:11 PM
is it just me, or is this flask vs django vs pyramid article super biased / opinionated? (it's on the longer side). They seem to hammer on that pyramid is more flexible, and that flask is mostly for smaller apps, but there is nothing really that supports that
also cabbages
I am myself assuredly opinionated, strongly thinking that frameworks with smaller footprint actually allow for much better customization, and more complex apps, as they allow you to actually architect a system, whereas heavier frameworks such as pyramid actually take that liberty from you.
 
@wim use stdout for both
@FélixGagnon-Grenier pyramid is more flexible. I'd not use Django for large apps.
@FélixGagnon-Grenier Donald Stufft chose to write Warehouse on Pyramid after careful consideration
 
How do I know when a bug fix is released in an update for sqlalchemy? The issue is resolved and the patch is merged but I can't figure out what the release schedule is to know when it'll come through
 
.. ok. I guess I don't see flexibility the same as you? What can possibly be more flexible than a way to register a handler and do whatever the hell you want from there on?
 
Nevermind, it looks like it's once a month.
 
@malan you may have to wait until the release is made to see
 
8:21 PM
@AndrasDeak Thanks. I found the pypi page it looks like he releases once a month. Hopefully soon. I imagine it will be in that.
 
@FélixGagnon-Grenier have you used pyramid?
 
yes, it's the framework that was chosen for most of our projects currently
arguably not long, I've been working on these components for maybe the last three months
 
@FélixGagnon-Grenier How different is it from flask?
 
everything is dependent on a global god registry object, which seem to be the war horse of said flexibility
 
it is app-global, not global
 
8:25 PM
fair enough, app-global god object ;)
 
which makes it not global at all, since you can compose several apps into one
 
Lately, I've been tasked with testing functionalities
that app-global configuration, have been giving me a lot of trouble, which is possibly because I lack experience with pyramid as a whole
 
then you should talk about it, got me and @IljaEverilä here :P
 
we've been using pyramid ~bout 6 years?
 
8:28 PM
heh
well, for now I've had a general feeling that yes, it's probably me, so I'll keep on reading documentation
but I'll assuredly come back with specific questions, if they arise
 
How different is the Django ORM from SQLAlchemy?
 
@malan very...
that's django orm
that's SQLAlchemy
 
lol. Is that why so many people use Django?
 
it comes with the package. So... django is like
 
I started learning python webdev like 4-5 months ago to build a pet project and I started with Django and saw how much it wanted me to build a blog-like app and threw in the towel and found Miguel Grinberg's tutorial.
I guess if you're building an app Django wants you to build it's like that, but building something strange seemed like impossible.
 
8:37 PM
yes.
Django was extracted from a news website... it is a CMS toolkit
but also such that people think it was the first Python web framework...
 
This pyramid's bloated like django? Or does it do flask-like things easier or something?
 
it is slightly more bloated than flask, but you're not required to use that.
 
it makes your razors sharp again
 
I advocate Pyramid and davidism is a (the) Flask maintainer
 
8:41 PM
@AnttiHaapala Armin doesn't work on it anymore?
 
doesn't look like it
 
Meh, I think my problem is that I perceive some frameworks as tools that were built for people that actually don't like / want / are able to do actual architecture. When I use one that kinda get in the way of dependency injection my very important preferences, I tend to be sad
for instance, it makes not a single bit of sense to me that a request object, supposed to represent an http request, have a registry/config property, in which a gazillion configuration options are stored
 
pyramid does inversion of control via the service locator pattern
 
Amazing. Every word of what you just said was wrong completely alien to me
 
8:46 PM
:P
 
:P If I didn't know Andy II, I'd think he'd been drinking :D
 
I'm working on my massive mid-term grading backlog; it probably hits me harder than a few shots of tequila
 
hmmm... tequila
 
@AndrasDeak You are a professor? That actually makes a lot of sense come to think of it...
 
8:49 PM
not really
 
not really a professor?
 
yup
 
wim
@AnttiHaapala actually, I was in the audience for this one
 
I mean, anybody can call themselves a Professor these days but I don't
 
Anybody can and some even do
 
8:52 PM
Sure... there's all of that. I still admire those who teach. Dr. Deak has a nice ring to it!
 
especially if one knows that it doesn't rhyme with Meek
 
wim
I use all three (pyramid, django, flask) and my preference goes in that order
 
and I do not. As I wrote that I thought "The way I'm saying this in my head is totally wrong."
 
wim
but these are hardly the only 3 choices avail today
In 2018 I've started a big project atop falcon and a micro project on cherrypy
 
@wim Don't you start to worry about support with projects that small?
 
8:57 PM
> Unburdening APIs for over 5.78 x 10-2 centuries.
^ that's my kind of humor
 
wim
cherrypy is actually way older than flask, so I'm not really sure how flask got to be so popular
maybe cherrypy used to suck..?
 
> This account is temporarily suspended network-wide. The suspension period ends on May 11 '24 at 17:59.
 
woa
who dat?
 
wim
@malan no?
 
8:59 PM
@wim Isn't that what happened to Python? It's like from the early 90's but it blew up like the last 5-10 years.
 
@wim marketing
 
@wim I usually have "size of project" in my calculus for picking technology
Are @'s rude?
 
recbg
 
out-of-context or unnecessary pings are inconsiderate, yes
directed replies are often OK if they convey extra context or if multiple discussions are going on in parallel
 
Aye
 
wim
9:03 PM
unless your name is kevin
 
It's michael ;-)
 
So Andras, how is it pronounced? Like Dee-yak? I should stop mentally mispronouncing your name.
 
wim
something to display in the GUI the count of posts that are closed as duplicate of the current post
 
the "linked questions" is a good start
 
wim
9:10 PM
that's (probably) limited to 10 or so ?
 
Man we live in a beautiful world. Technology is amazing. Ok, I know how it's pronounced now but will likely never be able to say it properly.
 
wim
I was thinking an ajax query to sede. (something like this.
 
wim
yes but linked != duped
 
but I don't think you can filter that list
@wim I agree, I was reflecting on "limited to 10 or so"
 
wim
9:11 PM
I guess that is as equally helpful number though
nice hint actually, should be easy to ajax query that and stick it into the DOM, rather than use sede
 
one could parse the linked list and grab the dupes; still wouldn't be foolproof but no SEDE
 
wim
what's pagesize max? 50?
 
yup
 
wim
is [duplicate] at end of title reliable?
 
that is, but there's no guarantee that they're not just mentioned in a comment (hence not being foolproof)
here's an ancient dupe-list-in-question-body dupe, still has [duplicate] at the end stackoverflow.com/questions/2899643/…
 
9:22 PM
interesting, it's not even possible to edit the dupe links
 
I'd say "no repro"
 
9:40 PM
I can't wait to see how they'll make it even worse
 
Good to know that the HNQ list is SE's biggest problem at the moment. For a second I was worried that there might be more important things to fix.
 
"While we probably deserve some egg on our face for relying on regular expressions as a go-to quick fix, they've been sufficient for ensuring trigger words and overt clickbait was kept out of the list for the most part." I wonder what that list of words looks like... I could probably guess about 95% of them but I bet there are a few that would surprise me.
 
wim
please don't remove the HNQ list from the sidebar
it can just quietly disappear imo
 
the company likes it because it generates clicks, and small sites like it because it generates some traffic, most of which is not all that bad
 
wim
9:57 PM
well, they like it to be a "controversial network questions" list then, and should just ignore the whiners on twitter.
 
10:13 PM
Can someone help me convert this curl post request to a python post requests?
The response I am getting is {"response":{"status":422},"errors":[{"message":"Unknown symbols"}]}
So I think there is something wrong with my dict syntax
 
probably worth writing a question about.
What version of python and etc?
 
Python 3.6.5
 
speaking of HNQ ^
 
wim
what the dupe for order of loops in comprehension? this could use it
 
10:21 PM
I have an answer in one
sec
 
I can post a question, i need the rp anyway
 
was just looking for a quick help since im new to python and it seemed like a quick fix
 
@wim in fact you have the accepted answer there.
 
wim
what's the gif, I assume it's one lunar cycle?
@AdamSmith heh, coincidence. LGTM
 
10:23 PM
@ex080 probably is a quick fix, but seems like a useful exercise for future googlers too.
 
@wim the libration of the Moon, which is raised as an example that the Moon can't be flat. See also libration lets us see more of the Moon's surface
 
RE: beeceptor: that's really cool, but keep in mind:
What about privacy?

Beeceptor is a request interceptor and a router. If the dashboard page is open, these are sent over web-socket to inspect. Anyone with dashboard page open can view and inspect request and response payloads. The server persists information about the channel (like settings, rules, etc) and requests (like, target url, headers and payloads of requests and responses, no. of hits to an endpoint, etc).

Note: You are advised not to send production secrets, passwords or api-keys in any of these: headers/body/payload/url
I'd never seen that before though. That's awesome :)
 
i love iter and next they are so useful
 
I was also recently introduced to Postman, which is a nice GUI/test runner for the client end of REST APIs
 
@AndrasDeak Did you just moon everyone? Eww... :)
 
10:27 PM
apologies to any werewolves in the room
 
cabbage all
 
@vash_the_stampede wait 'till you realize you can send into generators :)
 
*coroutines
 
six of one
 
except just realized I could solve the problem without iter sadness
 
10:39 PM
I was wondering how SO chatroom channels are determined is it be location(state or country), timezone , or randomly. if anyone knows please share
 
what do you mean?
 
"channels?"
 
yeah like there can't be 62 people online in all of stackoverflow chatroom(s) and i remember reading online somewhere the question (should we bring all of the SO chatrooms together)
but i could find how they're divided
couldn't *
 
wim
Why can't there be 62 people online
 
I have no idea what you're talking about
 
10:48 PM
like all of SO there's only (62) people in all of the chat rooms
i'll go find screenshots brb
 
Why not?
there are varying levels of activity, the "online users" page lists almost 12 full pages of users with 20 users each page. I suspect the 59 refers to users active in the past <short time frame>
 
i guess that make sense
 

« first day (2923 days earlier)      last day (2011 days later) »