« first day (3418 days earlier)      last day (1753 days later) » 
00:00 - 20:0020:00 - 23:00

00:33
When dealing with directory paths and filenames, should I stick with strings or use pathlib? For example, I need to change the extension of a file, should the filename come into my function as a string or pathlib? The code is only ever expected to run on linux.
I'd say your function should ideally support both
Ok, I just found that pathlib.PurePath() can take either a string and a PurePath as arguments.
So I guess it can.
The Path constructor accepts strings, bytes, and any kind of path-like object, yeah
cool, sorted, thanks
bytes paths never get any love
01:28
Is it dumb to use python on windows?
@JossieCalderon No, not at all. Why would you think so?
Everyone says to get a virtual machine because most tutorials are UNIX compatible
I currently use ubuntu but I previously used windows. I personally think developing on linux is easier but you'll never fully get away from a proper operating system like windows or macos because at some point someone will want you to open a powerpoint or run a program that is mac/windows only. Just get good at whatever stack you choose and that's all that really matters.
what's up python crew
I've been trying to learn programing on my own for a while and the journey has exposed me to many languages
Yeah, I'll do that! Thanks. Just wondering, the mkdir, dir, cd and rmdir commands don't work with python activated e.g. in the shell, right? they only work on command prompt when python is not activated.
:48665874
01:42
how can I become more proficient with python? can some one suggest a project
@dcrearer You can pick a lot of projects...just browse realpython
@JossieCalderon yes but if you are using an IPython interpreter there are "magic" commands that are envoked with % that allow you to change directory with cd from the shell. Other than that you have to use the os library
Got it, thanks
also windows powershell mimics many linux commands with aliases IIRC, just FYI
is anyone practicing DevOps with python here?
01:48
@Dodge you're the effing bomb man, thanks. no longer need to use the os library lol
No problem, os library is great for many things so don't forget about it entirely :)
env\Scripts\activate.bat doesn't activate the (env) prefix...is that normal on powershell?
Not sure, I won't be able to help with that, I can offer this link to a relevant question
02:08
I'm pretty dumb, I was ignoring the error...didnt even bother to read the error, thought it was a syntax error...but running scripts was disabled.
It worked, thanks again Dodg.
I just asked here because I genuinely thought that there wouldn't be a question on SO. you have blone my mined
20
Q: Meaning of python -m flag

Koustav ChandaWhat does -m in python -m pip install <package> mean ? or while upgrading pip using python -m pip install --upgrade pip.

03:04
I run scripts with env/bin/python my_script.py when using virtual environments
So I don't have to explicity activate/deactivate environments
 
1 hour later…
04:26
Does anybody know what the most popular and well supported yaml-to-xml package is?
 
2 hours later…
06:00
Is this piece of code same: 1) "if value is False:"
2) "if value in ['', None]:" ?
3) if value == '' or value is None:
Just trying to find pythonic way
06:15
cbg patch
user11585758
guys , anyone who knows autoencoder things .
user11585758
I was doing autoencoder https://blog.keras.io/building-autoencoders-in-keras.html

but it give less error in mean squared error rather than binary_crossentropy ,
06:41
just was wondering what the pythonic way of accessing elements between two dates over a 1 year period in a dataframe, shifting on a monthly basis (the dates being shifted over are tz aware)
07:06
cbg guys
>>> value = ''
>>> if value:
...     print(value)
... else:
...     print('value is empty')
...
value is empty
@variable
07:25
Hi Guys
Need some help on this question. Thanks in advance
0
Q: How to retrieve all validation differences when comparing XML file with XSD file

vikas madooriI have been trying to find the validation of XSD file with XML file. But unfortunately I am getting only the first difference while checking the files. I am using asssertValid() which only giving the first difference i.e., "Pane" from the file. It should find all the difference i.e., "Pane" and "...

but it is not finding the subpanel from the delivery tag. It is still finding the first difference only. Could you please help me fixing this.
07:39
Proper dupe targets needed! One question was in need of a dupe target for How do you read an int from input()? It got closed into Program can't read integer values, which is itself (wrongly) closed into How do you input integers using input in Python?, where OP seems to have done something weird, redefining input()
And one of the most highly-upvoted questions How can I read inputs as numbers? is obsessed with discussing why Python 3 doesn't do eval() on input, hence won't understand 5 + 17. Even mentioning that becomes more anachronistic every day. (It just doesn't do eval(), so don't mention it at all)
Gotta live in the present..
cbg-ning
08:04
Everyone using conda, it seems that openssl prevents conda updating python 3.7 to 3.8?!?
I have 3 Django models and I want to populate the model using a form. I have tried with one modelform and it works but when I try to add the second model, it doesn't. I have tried one solution from SO and I get this error: unbound local error. I have try to fix this error but can't find what might be the issue. my code below:
def new_rental(request, pk):
    rentalproperty = get_object_or_404(RentalProperty, pk=pk)
    user = UserModel.objects.first()
    if request.method == 'POST':
        rental_form = NewRentalPropertyForm(request.POST, request.FILES, prefix = "rentals")
        contract_form = NewContractForm(request.POST, prefix = "contracts")
        if rental_form.is_valid() and contract_form.is_valid():
            print ("all validation passed")
            rentalproperty = rental_form.save()
            contract = contract_form.save(commit=False)
Traceback error:
   response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\s1900147\Documents\Development\trial\rental\views.py", line 68, in new_rental
    'contract_form': contract_form,
UnboundLocalError: local variable 'contract_form' referenced before assignment
[24/Feb/2020 08:28:48] "GET /rental/new_rental/1 HTTP/1.1" 500 67347
Thanks for your time.
08:24
@variable Case 1) does something completely different. Cases 2) and 3) are almost equivalent.
08:41
@superv Do you know what UnboundLocalError means? What do you think is the value of contract_form in the else: branch?
@MisterMiyagi case 1) "if value is False: - this means '' or False or None. So can you advise me why this is compeltely different
Do youmean covers more things like []
@MisterMiyagi I am not total sure. But I think it means it is not connected to the database. I assume the value should be the data from the request.POST. Am i wrong? :)
@variable if value is False literally means just value is False. It does not check for '' or None.
@superv When you are in the else branch, there is no request Post. contract_form cannot be filled by the request post in this case.
@MisterMiyagi, You are right. I reassigned the variable contract_form and it errors goes away. Unfortunately, I can only see the template rendered but no form. Do you have any idea about that?
Thanks for the leading question and for your help. :)
09:10
@Aran-Fey don't know if it's still relevant, but you asked a while ago if pythons stdlib html/rcp is safe. since then I found pypi.org/project/defusedxml, which is at least trusted enough to be recommended by the openstack people.
09:28
Any idea how to fetch value of formula cell(not the formula itself) from an excel sheet?
I tried openpyxl and Pandas, both are returning formula
user10984358
09:44
stackoverflow.com/questions/28517508/… did you try this? seems like it might work
@TheNamesAlc Great Thanks
There are many similar questions on main site, should we cast dupe vote on all of them?
hi there, I was wandering if someone might help with a question. stackoverflow.com/questions/60372498/…
user10984358
you can only ask for questions from main site after they are 2 days I guess, room rules
Or should I answer all of them? ( ͡° ͜ʖ ͡°)
ohh, didnt know.
user10984358
09:55
lol
@Arne Good to know, thanks
@moshevi people that are interested in answering questions are watching the main feed anyway, so posting a question link doesn't really do anything
@Aran-Fey it's quite nice that this lib also includes info on what it actually does, i.e. what are possible xml exploits.
11:13
Hi guys can anyone suggest me best tutorial or guide for web scrapping using python
the first search result on the internet that uses requests library will suffice.
any video tutorial can you suggest
same sentence applies. literally just pick any, they're all the same. scraping is more often than not built on the same building block, and the real challenge is usually presented by the website you're trying to scrape
Yes
Actually I want to try scrapping this website artsandculture.google.com
google sites are usually a pain to scrape. they're very good at obfuscation.
11:21
Or have an API you can/supposed to use
in github I searched one API
In general though - yes - what tools you use depends on the site/other constraints... but you might also want to check out scrapy @G.Lakshmi - it's fairly good at what it does and nicely scalable and extendable...
github.com/gap-decoder/gapdecoder this is the script I had searched in github
yes can you say what tool is the best and easy
Sounds like there's a very good chance that url doesnt want to be scraped. Also, a very good chance you won't find a solution that will just work. Also, a good chance that you shouldn't be trying to scrape this specific url.
What I didnt get you @ParitoshSingh
11:26
@TheNamesAlc Should I post an answer in the same thread? The answer which gave me clue is half-done.
the website you're trying to scrape. It doesn't want to be scraped.
Is it why is the website blocked
aka, maybe don't scrape it.
Ok @ParitoshSingh
This is the answer: stackoverflow.com/a/55793741/1944896 which gave me clue.
11:27
then what can I try firstly
@JonClements What do you suggest?
@TheLittleNaruto cbg o/.... in regards to what exactly?
@JonClements Read my 2 previous messages
excel formulae stuff?
a coherent tl;dr?
11:31
Yes
is there something that your answer would add that isn't already present?
What'd you come up with in the end?
Yes
Looks like I found the right question where I should post that as answer
3
Q: A whole sheet into a panda dataframe with xlwings

CoolpixThanks to panda, we could read a whole sheet into a data frame with the "read_excel" function. I would like to use the same method using xlwings. In fact, my Workbook is already open and I don't want to use read_excel function (witch will take too long to execute by the way) but use the power of...

There is no mentioning of reading whole sheet.
That is what I want to add
In above thread too, all the answers are just workaround.
Okay.... so those existing answers seem you have to know N/M or kateryna's expanding trick? Is what you've got an explicitly cleaner/robust/builtin method that's basically xlwings version of pd.read_excel('somefile.xlsx', sheet_name='whatever') ?
@JonClements Yes exactly
11:41
Don't see why not then...
Great thanks :)
If you've got something to do it in a more xlwings'ic way - then certainly makes sense
Posted! Please edit if required.
@TheLittleNaruto thanks to panda :|
11:45
🐼
posted an answer to a python question, feels like a ** ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿**
Have you seen a doctor about it?
I would see @JonClements instead.
user11585758
Any ML developer here
user11585758
i want to ask something
user11585758
11:57
regarding making the dataset from raw images with their labelings
@TheLittleNaruto not sure about that... I hear that puppy is tricky :)
user11585758
I have images having pneumonia, non pneumonia. along with train, test, and validation.

Now i want to make training datasets with the raw data
user11585758
I am confused with how to make same index image with labels
@shad0w_wa1k3r at your convenience, could you please have a look at this dpaste.com/3B72VSF? Is that the right way of adding multiple form to multiple model ? It's an extension of this: stackoverflow.com/questions/60280319/…. Thanks
user11585758
I found tutorial but can you guys help me how to do this

def get_label(img, type=''):
"""
Arguments:
img: image
type: 'normal', 'pneumonia
Returns:
[label]
label:[0,1] 1 for pneumonia , 0 for normal
"""
if type=='normal':
return 1
elif type=='pneumonia':
return 0



train_dir_normal = train_dir + '/NORMAL/*.jpeg'
train_dir_pneumonia = train_dir + '/PNEUMONIA/*.jpeg'
train_dataset = []
for normal_img in glob.glob(train_dir_normal):
normal_label = get_label(normal_img, type='normal')
img = cv2.resize(cv2.imread(normal_img, 0), resize_shape)
12:10
Hi guys, have a small doubt.
After creating a pypi module, how to prevent display of imported modules in intellisense (or after Ctrl+space).

Say if I press Ctrl+space, modules like sys, os, subprocess are also displaying along with my function. So how to prevent that?
Add an __all__ definition to your module
user11585758
ok guys anyway bye. :(
Thanks a lot @Aran-Fey :)
@superv Yes, to an extent. See stackoverflow.com/questions/569468/… , you are on the right track. Ideally you should handle the all forms not valid case by showing the user the corresponding error messages so he can correct the form & resubmit. See stackoverflow.com/questions/14647723/….
12:34
Hi Guys
Need some help on this question. Thanks in advance
0
Q: How to retrieve all validation differences when comparing XML file with XSD file

vikas madooriI have been trying to find the validation of XSD file with XML file. But unfortunately I am getting only the first difference while checking the files. I am using asssertValid() which only giving the first difference i.e., "Pane" from the file. It should find all the difference i.e., "Pane" and "...

but it is not finding the subpanel from the delivery tag. It is still finding the first difference only. Could you please help me fixing this
Say I have a Mage class with the two functions throw_fireball and lesser_heal, and a Knight class with the functions heroic_strike and first_aid. What would the act of replacing these functions with instances of an Ability class be called? Is that "abstraction"?
@Aran-Fey that would work for me
alrighty
@Aran-Fey I'd call it "generalisation", which falls pretty much in the same category
Ooo... Dgraph is on v2 now... will have to check that out later...
12:43
oh, I like that one better. Wikipedia says it's a form of abstraction, so I guess I'll mention both
@shad0w_wa1k3r Thanks. I was actually following the first link you referenced and I have added an error message. When I view the template, I only saw the submit button but not the form. Could this be from my template or the views is not correct? Thanks
@superv I'm not sure I follow. When are you only getting the submit button (& not the form)? Also, where have you added the error message? I you can, you should use django-debug-toolbar.readthedocs.io/en/latest it's quite helpful in debugging. If necessary, please link the corresponding template. Also, did you check the 2nd link that I gave?
I can't stress enough how usefull DDT (Django debug toolbar) is. It'll give you all the information associated with a particular page / request. The installation is quite straight forward with hardly a couple of lines to change for a simple setup.
13:00
@shad0w_wa1k3r I have made some changes and added the template here using some examples from the 2nd link you referenced: dpaste.com/02F18WM. I will install it now. Thanks.
@superv In your nested else, you forgot to return a response. You can just dedent the last return from under the outer else. See mine - dpaste.com/1QFETVF.
Note that you can reuse the rental_form & contract_form variables even if they are not valid (I removed line #16 in your dpaste), since the not valid ones will contain the validation errors which will be automatically showed in your form.as_p. Try it & you'll know.
@shad0w_wa1k3r I will try that once I return home. Is it possible to implement the same idea for more models ?
13:15
@superv Yes, you can involve as many different objects / models as possible. Performance might become an issue, but you can optimise later once you actually see significant delays in response or server loads.
@shad0w_wa1k3r Thanks so much, you are far too kind. I will let you know once I implement your version. Have a good one 👍🏼
13:33
cabbage all
@superv Thanks & good luck.
user10984358
13:50
@TheLittleNaruto I was away from my laptop, I see you’ve sorted it out. Unless the problem is not specific to you adding in new ways is always good acc to me. Most of the time I find the other answers useful.
14:06
Cbg
cbg
@PaulMcG Compliments, boons, greetings!
o/ Oy!
14:50
@Aran-Fey there's a rather old base at github.com/sopython/rabbit should you ever feel compelled to resurrect it :)
That looks like way more than just a chat bot. Not quite sure what's going on in that repo tbh
It's our residential chat bot that does a lot of things.
I believe Kevin was the spear head of that project, you can chat with him.
Basically, I muddled something up in an hour or so, then Kevin/others had a go at doing a bit more with it/tidying up, then it got forgotten about again... Mind you - it was looking slightly more promising than the one that went a bit mad
But none of the answers seem to work if I put the commands to Anaconda Prompt. My jupyter notebook base folder doesnt change and I cant explore parent folders. Also it starts on drive C whereas I want to start on drive D sometimes
Im on windows 10
oh Jon, you were the creator of our beloved rabbit ?
15:03
@JonClements haha, nice bug
@MooingRawr I was responsible for the original psychotic one, then just smashing bits together for the next one... but Kevin and others were responsible for trying to actually make it useful :)
mmm.... so kevin and the others extracted the good in your psychotic one...
Sorry Zabop, I know nothing about Jupyter
@zabop did you use forward slashes like the answers suggest? With backslashes you probably need raw string literals
@zabop Looks like your question got answered. Understand that when you are in a notebook, you are running a web page within a webserver, so you are inherently scoped within the directories under that webserver. The accepted answer tells you how to start that server on the D: drive instead of the C: drive. Also, if you are double-clicking on a shortcut to start the webserver, you can give it a working directory to run in - create different shortcuts for C: drive, D: drive, E: drive, etc.
user11585758
15:28
Hi guys
user11585758
guys i got problem , but that stack overflow answer seems not understanding how to use it ,

please could you help to solve it

my code is
train_dataset = np.load('train_data.npy', allow_pickle=True)
test_dataset = np.load('test_data.npy', allow_pickle=True)
validate_dataset = np.load('validate_data.npy', allow_pickle=True)


x_train = []
y_train = []

for features, label in train_dataset:
x_train.append(features)
y_train.append(labels)

x_train = np.array(x_train)
y_train = np.array(y_train)
plt.imread -> plt.imshow
that too
user11585758
:D , how stupid i am .
user11585758
15:36
Thankyou very much my brother @AndrasDeak . :* problem solved.
Quick question; I don't suppose anyone knows of a library that will attempt to break down a nested JSON structure into something that looks a bit more like a printable document? I receive web forms from some 3rd party company app and I can't really know the structure of fields beforehand. But I'm envisioning that something could give it a guess - bolded top level k: v pairs, indented second levels, horizontal lines etc.
How does an omniscient being who has been around since the Beginning of Time only have 27 rep?
@PaulMcG doesn't want to show off? :)
I can have a go myself with some basic heuristics based on what level of nesting I'm on, but I was just curious if something similar already existed
15:44
@JonClements I guess he/she is giving others a chance
@roganjosh I can't think of any... can only really think of those that try and effectively flatten a json document into a table...
@roganjosh how bad is pretty printing the equivalent dict?
It's totally legible for me and only goes about 3 levels from the examples I've seen, but it's not so friendly for people not familiar with computers
audiobook then?
Haha, that might be a bit far :)
I just want to vaguely reconstruct the web form into something that looks PDF-ish that they could print off. It's not vital and a first-pass of pretty printing at least gives the data
15:51
I have an issue of outfile.write(something) producing unexpexted results when print(something) with the same something produces the expected output.
What issue, exactly?
How did you open the file? MCVE, please.
Note that print(something) will implicitly call the __repr__ or __str__ method on the something, whereas outfile.write() will not.
am I allowed to paste the code here?
@Lamma if it's ~ 10 lines at most; otherwise use a code paste service, please
15:53
@PaulMcG SO is mostly athiests?
@roganjosh outfile.write(something)just repeats the input file
@Lamma please see our code formatting guide for chat and practice in the sandbox if necessary
that's missing too much indentation so I'll move it for now. Please repost it once you've figured out how chat formatting works (it's not trivial but with the linked guide it's manageable with some practice)
I think I have formatted correcntly
I can't see how to indent under for and if statments ---
and the guide does not seem to show how
16:02
If the guide and the sandbox don't help, use a code paste service as I suggested
Okay so this is the code:
https://paste.ofcode.org/34DXKtepxT8pfBYJAZ5J5Yv
thanks
@Lamma note that you can pass a file kwarg to print, then you don't need those newlines. Does that help?
Do you mean print to the output file instead of using outfile.write?
oh, how do I do that?
16:05
If that doesn't help you'll have to explain how your code doesn't work as expected.
@Lamma "you can pass a file kwarg to print". So pass file=outfile.
Doesn't look like you want to add more newlines... they're still be present from .readlines() - so you'll be creating blank lines...
the error is that currently the outfile is just a duplication of infile despite the trying to explicitly print only certain lines
I think you don't realize that you're enumerating only those lines that contain "M32" but then indexing into a list of all lines
@toonarmycaptain I'm having a chat with god at the moment...
indexing into a list of all lines?
16:09
Yeah, with readfile[i - 1] etc
@PaulMcG I often speak to people I have absolutely no faith in ;)
I want to check if the line above i contains % though
The current line isn't readfile[i], though. Because i counts the lines that contain "M32". But readfile contains lines that don't contain "M32" as well.
@toonarmycaptain Present company excepted, I'm sure
ahhh okay i understand, so I should put the if m32 statment in the body of the for loop?
16:13
Probably. But you haven't exactly explained what the code is supposed to be doing, so...
looking into the infile and then searching for any line that contains 'M32' then if a line does, extract the lines 1 3 and 6 spaces above it then write them to a file but only if the line 1 above a line containing M32 has a % in it, if not them just write the contense of the line 3 above an M32 line to the outfile
When you say "the line above", do you really mean the line above or the previous line that contains M32?
Your code doesn't account for the possibility that there is no previous line, by the way. Or a line 3 above. Or 6.
it might just still work but with incorrect lines picked though :)
But none of this explains why print (supposedly) produces the correct output and write doesn't, so no clue what that's all about
@PaulMcG Maybe :p
16:24
@Lamma Can you clarify how the output of write and print differs? Is that effect observable in the code you posted, or on a modified version only?
@Aran-FeyThe line 1 above the current one containing M32
@MisterMiyagi the print statments output only the requested lines, ones that are 1 3 and 6 above the current line containing M32, but the write statments just do nothing and just pretty much repeat the input file. I think it may have something to do with the else statment though
How many lines of your file don't contain M32?
If most files contain 'M32', and few files contain '%', the else clause will write most of your input verbatim.
This strikes me as a problem that we could collectively solve in about 60 seconds if we had an MCVE, complete with input file, expected output, and observed output
16:42
I'm voting to close this because frankly a failure to read the docs does not constitute a valid reason to ask on stack overflow. — Mad Physicist 3 mins ago
Want as close reason.
@MisterMiyagi I mean, sure. I believe SO feels that they'd like that info, and further explanation, on SO also.
Those kinds of questions can be pretty useful tbh. I read a lot of those when I google how to do stuff in javascript
I usually find RTFM questions distracting as they tend to attract unidiomatic, convoluted answers.
@MisterMiyagiThe vast vast majority
like 10 out of 1000
Is there anywhere I can upload an input?
> Encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object's components
Huh. So what's it called when you write a class with 3 attributes instead of using 3 separate variables? Is that not also encapsulation?
16:52
Encapsulation in my understanding means these 3 attributes aren't visible. You can only access or influence them through methods.
Now, those "methods" may include getter/setter, properties or other kinds of accessors such as __getitem__.
Which kinda blurs that line a tad...
Then what would you call using a class to bundle data? Or does that not have a name?
Disclaimer: I find the adherence to design patterns and their related terminology mostly laughable.
@Aran-Fey I'd call it "define an appropriate representation of the problem", truth be told.
I mean, I don't disagree. But when you're trying to teach newbies new concepts, it's useful if those concepts have names
I would not equate "encapsulation" with "data hiding".
Well, as far as I can tell, most of the design pattern talk is just stringing up cutesy names and hoping no-one finds out. It's not a consistent algebra, but subjective handwaving.
16:59
@Aran-Fey Abstraction would seem appropriate. For a practical approach, "bundling" also isn't that bad.
@MisterMiyagi My experience is different. I've found it very useful to use in team design discussions to have a shared vocabulary for patterns used in a proposed design.
The main issue I have with many design patterns is that I feel much of the cited literature goes back to mid-90's, and "design patterns" at that time were strongly influenced by limitations of C++ and Java.
@PaulMcG Those answers seem to match my understanding of encapsulation, so that's a relief. I might still just go with "bundling", though
@PaulMcG If the vocabulary is agreed upon, it's good old jargon. That's useful and separate from what I was talking about.
I'm also reconsidering my decision to link to various wikipedia articles... not sure if newbies can learn much from that, so I might just remove all of them...
I gotta say, I'm really struggling with this article. The other 3 weren't nearly as tough
17:05
It's using such terms outside of a sworn in peer group that I find questionable. Alas, teaching newbies kinda implies they are not part of that peer group.
17:33
Ooo, the postgres docs have the most unobscure warning box about SQL injection risks that I think I've seen on the issue. That'll make a nice link to throw back when people argue that it's ok "just in this project"
Well, psycopg2, actually. The SQLite docs are far less forceful
I think that even if the terms change, it can be helpful to have some vocabulary for describing ways of organising code in an abstract sense (ie 'patterns'), even if you have to translate later. Today's non-code case-in-point: to be able to describe this as a thing is helpful, even if the terminology changes.
17:46
@toonarmycaptain in the UK, we are "blessed" to have Piers Morgan yelling about pigs in blankets on morning TV. I didn't realise there was still a debate to be had that didn't involve a 10 minute raging argument and yelling
@roganjosh Ha. Is he talking about food, or the poor coddled bankers?
Loads of stores have started launching vegan pigs in blankets and he just blows his top that "vegan" is incompatible with terms that imply a meat product. So he just yells about it all the time
Well I'd disagree, as to me that implies that the pigs the meat is made from have been fed a vegan diet. But then I'd disagree with him on most things.
Ring him up and mention that interpretation. The UK will be forever indebted to you for giving him another angle to continue the diatribe :P
@roganjosh England Expects, right? xD
17:55
Ha, yeah. Continuing a proud and noble tradition :)
I proposed on the Python ideas mailing list that we make ~ a binary (i.e. a two-argument) operation in addition to being a unary operation (+ and - are both kinds as well).
They're not that receptive... :)
I was sure I had talked about it with the core developers before and been rebuffed, but I couldn't find a record of the conversation, so now at least the conversation is on record...
I hope they don't feel like I wasted their time...
18:12
What is the meaning of A ~ B?
(not wanting to start a redundant discussion here, but I may already be too late)
18:26
in statistics, A ~ B means A follows is B distribution. i.e. the value of A is drawn from a B-type distribution. For example, student marks are drawn from a normal distribution
@roganjosh Can't stand watching him... he just seems to moan about everything all the time :)
I checked this but I couldn't find out what were the changes that are relevent to this problem I am facing, here's code which seems to me to work fine in my local IDE( Spyder 3.7) but I ain't getting proper result when it is being runned on some external server. I have not given the detail of the exact example on which I'm getting so, in the hope that there might be obvious changes.
@PaulMcG well in Python, as of now, it's nothing, and the world is our oyster... :)
@AaronHall Ouch... yeah... a definite lack of enthusiasm there :)
@AjayMishra Works okay for me with Py3.5.2
This looks like pretty standard Python, I don't see anything that would have changed in recent versions.
18:34
@JonClements I was thinking about setting up a Nix build with a patch that applies my changes to the respective libraries, and then making that available (on the theory that if you build it and prove out its usefulness, they will change their minds) but I certainly don't have the time for this right now...
Also not sure given the current level of reception it'd be particularly worth your while even if you did have time...
actually, now I'm really curious: what would ~A do? I know it's the unary negation operator in pandas, but I'm unaware of it's functionality in vanilla python
binary not
@AaronHall I'm dabbling with some different forms for embedding DSL syntax into Python code, as a spinoff from the graph algebra (alga project) I posted a week or so ago. Since '->' is not a legit operator, I had to play some embedding-with-strings tricks (which feel like cheating, but...)
18:37
>>> bin(145)
'0b10010001'

>>> bin(~145)
'-0b10010010'
hmm, that's not not
@PaulMcG Thanks, I will recheck that.
oooh, there's a sign outside the binary, wow
>>> f'{~(-2) & 0b11111111:08b}'
'00000001'
>>> f'{~(~(-2)) & 0b11111111:08b}'
'11111110'
    An option I'm considering:

    @alga_function
    def plot_with_z(g):
        """
        plog g -> <Z>
        """
@AaronHall is that a 2's complement thing?
18:39
Consecutive ~s is legit syntax, no need for the extra parens
Yeah, I think so.
so I wasn't too wrong
you need a mask of 1's to & it with to see it
^^ s/plog/plot
(too slow)
wanders back in after too many years away...
18:41
So if you write your own classes for distribution algebra, then you can embed in Python with something like this. Not as nice as having an overridden operator, but this was how I worked around absence of '->' (or fudging by using '*')
@MattDMo I think you'll find the mad house hasn't changed much :)
@AjayMishra please be more specific about the issue when run externally from Spyder. There's a lot of "fun features" that you can encounter when releasing a script out of Spyder
@MattDMo hey
Howdy all!
@PaulMcG I have used comparison operators to chain for monadic binds...
18:43
@JonClements although I hear SE in general has had a few issues...
@AaronHall I think I've seen that hack, something like x |operator_word| y?
Oh... I must have missed those... whistles innocently :p
@JonClements well, maybe it just needs to be said! (Mostly it doesn't :P)
If you do this, operator_word has to be a valid identifier. I considered something like this, but '->' is not legal ident
I also considered '>>', but the precedence of operations gets in the way.
user11585758
Guys, What shape of image would be good for training the model in colab?
18:46
2-dimensional
Gotta run for a bit folks... Hopefully see you around later @MattDMo
user11585758
no , i mean that, my image size is most undistributed ie max of size (199,199) of xray dataset,
take it easy!
user11585758
small pieces of these would make unbelievable arts
user11585758
18:51
anyway making of 84*84 pix
@PaulMcG would something like macropy help?
I've pondered before whether it'd be confusing to have syntactically valid python code, but interpret it differently.
@PaulMcG Maybe(1) >= (lambda x: Maybe(x + 1))
Maybe(1) >= (lambda x: Maybe(x + 1))) >= (lambda y: Maybe.Nothing if not (y % 2) else Maybe(y))
returns: Nothing(None)
So Maybe is a class with override of __ge__?
@MisterMiyagi It is confusing. I confuse people all the time with pyparsing's use of '+' with implicit conversion of strings to Literals.
MacroPy is very interesting, thanks for the link.
19:04
@PaulMcG Hah, I would have gone mad without that one! It's A | B | C producing nested pairs instead of a flat sequence that gets me every time.
@roganjosh I am actually solving this programming challenge, for the maze:
.WWWW
.W...
.W.W.
.W.W.
...W.
I am getting false in thier tests, but when I passing this maze in my code in spyder it, I am getting True.
and there are numerous such examples.
From "thier" tests, I mean when the code is running on the servers(which is provided by the website) over which the code would run.
Have you run the code locally but outside of spyder?
No, not yet.
There is a complicated namespace based on IPython. The behaviour changed between versions, so it's not easy to answer a priori what might go wrong. That's your first step - verify the script outside of spyder
19:13
I tried on sublime(which I guess used python2) it is running fine[I mean I am getting the same output as that of spyder]
It seems to me that it's not my problem, it is the problem with the website.
Mmm. It's possible but we can't really help debug that unless you're not setting the problem up correctly for the site. I can't test anything atm because I'm on a phone
@mathematics - I don't think you are getting much response because you have left out some important bits. I have no earthly idea what shape of data set is suitable for your model. It often happens when people ask questions here that they leave out details assuming everyone is as close to the problem as they are, and already has all the context. (My apologies if you covered this earlier, and I just missed it.)
19:37
Question! I've been wrangling with the interpretation of typing annotations pretty much all of last week. Ultimately my goal is to take an annotated function, and bound set of arguments (literal BoundArguments produced from a Signature) and not just type check (typeguard FTW) but also type cast. My searches (which I occasionally re-attempt when getting frustrated enough) for existing packages implementing something like this have not gone well.
b) In attempting to implement this myself, the internal structure and mechanism of operation is really throwing me for a loop. I've got top-level annotation → concrete type mapping working, roughly, so def mul(a: int, b: int) correctly casts (or Number, or…), but trying to look up the base annotation class for a derived annotation, such as List[str] is driving me batty. To implement my abstract→concrete mapping, I need to get back to List from List[str], but so far, no dice.
@amcgregor Hold up, I don't understand. You have a function and arguments. You want to check if the types of those arguments match the function's annotations. And then you want to cast... what? If the types already match, what are you casting?
I'm not type checking, I'm just type casting.
gist.github.com/amcgregor/415813e9d9dd8d374be6e5b952b20435?ts=4 is my WIP code so far exploring this problem. For the "simple case" (example function) the age is cast properly. Now I'm trying to deal with Iterable[str] "tags".
Needing to turn the abstract Iterable into a concrete type, which I can then descend into and iteratively apply the annotation's __args__.
The premise is that all values being submitted to the function will be unicode text strings. ("Coming in from the web.")
(Or from a command line invocation, or…)
My very first implementation making use of annotations treated them as arbitrary callable objects accepting the value from the web and returning the "native" value. This works for many things, including interesting uses such as def hello(tags: str.split): — but now that typing is real, I want to actually use proper annotations… and need to reverse-engineer from them the correct concrete types to use.
A bit confused about what you need help with, but if you're looking for code to get List from List[int], I have an answer for that somewhere on SO
...I think
type(List) == type(List[int]) == typing._GenericAlias which made me sad. 😉
Because otherwise typing.List is fully usable as a dictionary key.
Maybe just grab the code from my github, that should be up-to-date (3.8)
19:48
Ah, the assistance is required with resolving the mess ~193→196. Nice. Your code is beautiful, Aran-Fey.
Is it? Are we looking at the same code? :P
It's a mess, but I blame that on typing
Ahem, preliminarily booked a hotel for PyTexas. Bring on May!
@Aran-Fey gist.github.com/amcgregor/… are my "handler" functions for different base types of annotation. The first has a terrible mess of indirection only partially working, your code will very likely correct that. Though I'm noticing I'll be restricted to 3.8+ after I do correct it, since get_origin is too handy.
My get_base_generic should work in all versions, including the backport (though it's been a while since I tested it on an older version, so I might've b0rked something)
00:00 - 20:0020:00 - 23:00

« first day (3418 days earlier)      last day (1753 days later) »