« first day (3523 days earlier)      last day (1418 days later) » 

1:10 AM
@roganjosh I mean, it somewhat sounds like they want something akin to interpolation, but I can't figure out what they want that is different from interpolation. I think maybe they want the equivalent of OpenCV's remap?: stackoverflow.com/a/46524544/5087436
 
@roganjosh It's a matrix transformation (expressed badly) that is used with machine vision sometimes. I would call it more set or basic matrix manipulation than linear: there's a really good answer in Java which just explains the basic algorithm
 
@LinkBerest It's the "accumulate" part that is confusing.
 
hence: expressed badly - in this case they just need to put a "plain English" explanation of what they are trying to achieve or its just going to be a bunch of guess work (definitely not linear alg. though)
 
hello looking for some python help on a simple json structure
 
 
1 hour later…
2:42 AM
@kingjtiv here
 
 
2 hours later…
4:41 AM
@kingjtiv rbrb
 
 
2 hours later…
6:38 AM
cbg
 
7:08 AM
Hi there. I have a question regarding the issue I am currently facing. Can anyone please help me out on this.
ContextualVersionConflict: (Django 1.11.10 (/usr/local/lib/python3.6/site-packages), Requirement.parse('Django>=2.2'), {'django-picklefield'})
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "django/core/management/__init__.py", line 338, in execute
django.setup()
File "__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "django/apps/registry.py", line 85, in populate
 
hey all
I'm getting a wierd issue on Pandas. I am reading a CSV into a dataframe and the row number is becoming a merged column with the first col
if I set the first column as the index, that gets merged with the next first column
so my dataframe always has an index column that is has 2 sub-cols
Please see below, where the Date column also spans the index col:
Date AAPL MSFT ... WF TOL DNKN
0 2020-06-04 8.341626 0.60407 ... 0.0 -84.633742 -14.620048
if when I set the Date col to the index, then that will also span the next col AAPL
using Pycharm, maybe thats the way its being shown. havent used pandas in ages
cant seem to add screenshot
 
7:56 AM
Cbg
 
@PruthviBarot I think you got the wrong person.
 
@Mirza715 I think you are using django 1.1 with python3.6 so it's giving version error try to install django 2.2 by pip3 install django=2.2
 
@PruthviBarot Yes I am using Django 1.11 with Python3.6 but I didn't get this error before
 
8:12 AM
You have both python version installed 3.6 and 2.7 in your machine?
 
about this regex
stringer = "-000.56"

import re

if re.findall(r"[+]?\d*\.\d+|\d+", stringer)[0]:
    print("True")
why is this statement true ?
 
@PruthviBarot This error came on aws logs after the build fails.
 
expectet outcome is false
 
@Mirza715 What i try to say is either you have to install python 2.7 or 2.8 on your server or you have to install django>=2.2. Before you are not getting error cause might be both python versions are installed in your machine so if you try python manage.py runserver it will address python2.7 and if you try python3 manage.py runserver it will address python3.6 or above
 
Does somebody have expertise with requests? I don't get it according to the doc: requests.readthedocs.io/en/master/api, I should be able to set cookies like this:
response = requests.post(url, data=post_data, cookies=cookie)
but looking at the response in the debugger than checking request I don't see cookies set.
ah, it's under protected attributes
 
8:58 AM
Ok, I figured it out. I don't get it why it is this way, because it seems useless, but it works now. I needed to set the csrf_token in the body and as a header:
cookie["csrftoken"] = cookie["csrf_token"]
post_data["csrfmiddlewaretoken"] = cookie["csrf_token"]
response = requests.post(url, data=post_data, cookies=cookie)
 
Sam
10:06 AM
Morning all -- pytest question. Assume I have a class which loads a word2vec model (which I want to avoid instantiating)... for testing, I want to mock out the model instance, but I'm not entirely sure the best way to do it... I've written some pseudocode which uses the setup_class method to instantiate a class object but I'm not entirely sure the monkeypatch will work repl.it/repls/ScholarlyCrimsonPlot What is the right/reasonable way of doing something like this?
 
@roblox regex101.com is a great place to work out regex issues
 
10:28 AM
Hello everybody
Can someone can help me : I want to write a regex to match this sentences :
VGM. nn s sn nnanneeeenmmemeeneues 85 u3 78 à 98 86
I write this regex : ^(\w+)(.+)(\d+[\.|\,]\d+)[\s]{0,2}(M|[\s]|g|G|m|%|picong).(mm3|100ml)[\s]+(\d+[\.|\,]\d+)\s+(à)[\s|](\d+[\.|\,]\d+)[\s]+((\d+[\.|\,]\d+)|\d+)$
but don't function
 
Nobody will be able to read that. But it seems to me you're expecting , or . in the trailing numbers
 
Hey cyrille, your matching digits on the third capturing group, no? there aren't any digits that can be found there
but as paulMcG pointed out, regex101.com is a great place to debug your regex code
 
10:51 AM
regex101.com/r/lgyrSi/1 please there is a link ,
 
Good Afternoon everyone-question is related to panada.specifically in read_csv() function.Actually my file is tab seperated and double like("xyz") .when i load the file in python environment using read_csv (using line read_csv(path,sep='/t',engine='python) but when i read the file i am getting dataframe but data is also under double quotes as like csv source file but a much i know about read_csv double quotes automatic remove when when dataframe created.
 
@cyrillegate I'm not sure regex is appropriate here. This looks more like a space-separated csv.
Random thought of the day: Is there some generic variant of CSV? ???-Separated CSV is worse than ATM Machines!
 
I think csv covers other kinds of SVs. Like, tsv is a thing but really that's just csv with a non-trivial separator.
 
But, say, a "Space Separated CSV" is actually "Space Separated Comma Separated Values". That's like reverse redundancy.
 
I received data from ocr
 
10:59 AM
"space separated csv" was never an option
@cyrillegate ugh, then indeed regex seems like the wrong tool, or a premature one
 
So It's not a csv format
 
you need to clean that noise first
 
Those aren't separaters (separators?), they are decimals
I don't think there are any intentional commas anywhere in that text - either they are decimals in French locale, or the OCR got confused, or both.
Note the strings of mixed '.' and ',', and some values that look like they should be floats (like percentages) have ',' decimals, but other float values have '.' decimals.
 
If I want to clean up, I would have mistakes because sometimes tesseract ocr gives me the text for example as :

VGM. nn s sn nnanneeeenmmmeennuuees 85 u3 78 to 98 86
or
VGM. ............................................................ 85 u3 78 à 98 86

text format i want to retrieve is like :

xxxxx ......................dd,dd %|...... dd,dd|dd % dd,dd|dd à dd,dd|dd dd,dd|dd
 
oooh, lab results
 
11:06 AM
In orginal picture the nsssssssn nnnn is dot (.....................................)
 
@PaulMcG Those numbers are [from] (á) [to], [actual]. It's just that medical software is often crap, and nobody cares if the limits are given with decimal dots and the actual value with a decimal comma
@cyrillegate you should probably clean your picture before running OCR on it. I'm pretty sure you'd be better off removing the dotted lines, for instance.
(but I'm not an image processing/image recognition expert)
 
@Andras
 
Sam
Managed to get chat.stackoverflow.com/transcript/message/49581743#49581743 working with pytest fixtures and monkeypatching :) Will leave the updating link repl.it/repls/ScholarlyCrimsonPlot#main.py in case it helps anybody
 
@AndrasDeak , thanks andrea for your help, but I clean image before put it on tesseract engine.
 
not Andrea, but you're welcome :P
 
Sam
11:11 AM
@AndrasDeak Alias ;)
 
@AndrasDeak Ooof, OCR of sketchy input - a riddle inside a conundrum
 
I have a namespace which I get from argparse. args = parser.parse_args(). I want to log the args to know with what args the program ran, but I don't want to log the password and username. Is there a way to change the printfunction for the namespace to not print the username and pw? Or what is good approach for having a log of the config, but without the sensitive information?
 
Didn't you get the memo? Andrea Deak is the long-lost sister of Andras Deak.
 
@Hakaishin is there a reason why you rely on the NameSpace's native repr, instead of just printing the data yourself?
 
@JossieCalderon or Italian cousin
 
I'm learning about docstrings
 
11:39 AM
when you say printing myself you mean iterating trough it?
 
@Hakaishin either copy the namespace and clean the copy or only log away specific arguments. the argumentparser cant know which parts are problematic to you
 
An alternative is to define your own (str subclass?) type for the pw and username, which never have a legible repr. that avoids exposing the data by accident.
 
Fair enough. In my dreamworld I could do: parser.add_argument("--password", type=str, help="password", sensitive=True) and it would change the print behaviour :P
 
You'd end up with parser.add_argument("--password", type=secret_str, help="password")
 
11:41 AM
oh, I like that even better
 
@Hakaishin just FYI there are some pitfalls subclassing str in python, which you can check here: bytes.com/topic/python/answers/…
 
I don't think he should subclass str. Just the namespace.
 
@AndrasDeak Could you elaborate? I can see how I could implement @MisterMiyagi solution. But not sure how to achieve the same effect by subclassing the namespace
 
For a start, I'd go for some almost-empty class that contains a str.
 
Ah, I see Miyagi did actually suggest subclassing str. Then ignore me.
 
11:47 AM
I don't know - subclassing str usually has a problem that requires implementing __new__, but in this case (assuming the namespace logger uses repr() to print its values), you can just override __repr__:
class secret_str(str):
...     def __repr__(self): return "I'm not telling"
...
z = secret_str("sldf")
z
I'm not telling
print(z)
sldf
 
like this right?:
class Password(str):
    def __repr__(self):
        return "secret"
nice, that worked :)
the debugger can see it ofc, but that doesn't matter. Does anybody see any caviats with this approach? It feels a bit sketchy, but also simple enough to be good
It's exactly like str, just printing is different right?
 
@DJ_cascurity hello. Please ask in the PHP room instead. Or the Java room. Or anywhere that is not here.
 
thanks then
 
Or you could just read Chapter 2 of Michael Goodrich's Data Structures in Python
I love that book. That chapter talks about classes in specific.
 
@Hakaishin yes. be aware the various methods will return a regular string, though. So if you need to slice, lower, or strip the Password, make sure to convert it back to a Password again.
 
11:59 AM
Yeah, I'm just checking all the places where I use it, but I think this should work nicely :)
 
Guys is there a bug in Python 3.7 on trying to color the background? print("\x1b[1;32;40m Bright Green \n") doesnt work. Weird just weird.
 
@ExoticBirdsMerchant works for me using pycharm and py 3.7.6
 
@MisterMiyagi Ugh, now I wish I had unittests. Well time to write them
 
@DennisHügle Hallo mein Freund na ja on me it outputs  Bright Green Python 3.7.3 and Win 10 Home. I used IDLE
I have a bounty on this topic
 
@ExoticBirdsMerchant those are ANSI escape sequences. The terminal/viewer interprets them, not Python.
 
12:10 PM
Terminal/Viewer? that means windows?
 
whatever you use to look at Python's output
IDLE, judging by your description.
 
yes
so i see the output on the IDLE
 
I use PowerShell in Windows
 
is that correct could you expand on the terminal/viewer wording
aha so it has to to with the IDLE terminal/viewer hmmmmm
It seems we have a buggy situations hier..
 
What error are you getting?
Try reproducing it by running python-3.8.exe
 
12:13 PM
@JossieCalderon instead of the words with a coloredd background i get this  Bright Green
 
Searching for "windows terminal ansi colors" offers a number of options, including poking at the Windows registry.
 
when i type this print("\x1b[1;32;40m Bright Green \n")
 
@JossieCalderon - this isn't a Python issue, it's the terminal viewer on Windows
 
Could be the character coding then
 
@paulmcg i found links on ANSI colors ... ohhhh an issue of windows!
 
12:14 PM
IDLE on MacOS also doesn't display it correctly.
 
but it is an IDLE it is Python .... or not?
didnt knew that
 
AFAIK IDLE uses TKInter for rendering.
 
aha so it is maybe a TKinter issue
 
It's not.
You are feeding ANSI to something that does not speak ANSI.
 
OHHH! okay
aha so tkinter of Python 3 IDLE does not handle ANSI
 
12:16 PM
Ok, so this in 2020 is just awkward: stackoverflow.com/questions/15008758/…
 
Thats why an online parser works fine is is a different system
 
I now have to specify --crop "" instead of --crop False, meh
 
@Hakashin - look into argparse.add_argument action or default parameters
 
I have default params
And I saw, store true and store false, still that's just akward
 
@PaulMcG If you know a dupe for the Packrat question, feel free to hammer. I didn't bother searching this time.
 
12:28 PM
Yep, found one from 2012.
 
12:57 PM
Ehm, I have an env var x1 set to 440, I check that with echo $x1. But configargparser doesn't take the env var value, but the default value. Am I missing something?
parser.add_argument("--x1", type=int, help="x1 crop", default=400)
 
Is this an upper/lower case mismatch?
 
no I checked
 
Reading this doc (pypi.org/project/ConfigArgParse), it does imply that env vars would supersede a default value.
 
haha, yes that's why I'm confused
echo $X1 returns nothing and $x1 gives me 440
and checked the code the x is small
 
1:13 PM
is there any way to use python to open an extension-less video along with an FLV.exe without os.Popen?
 
what does open a video along an exe even mean?
 
@Hakaishin Have you ever opened an extension-less video, only to be asked to choose a program to open it with?
 
ugh yes, but this sounds like an xy problem
@AnnZen ?
 
@AnnZen Do you know the format of the video?
 
flv
opps, i meant subprocess.Popen
 
1:18 PM
import configargparse
parser = configargparse.ArgParser(default_config_files=["start_camera.ini"], description="Starting different cameras")
parser.add_argument("--x1", type=int, help="x1 crop")
args = parser.parse_args()
print(args)
Could somebody pls run this, to confirm that there is a bug, then I will make an issue
 
"confirm that there is a bug"?
 
configargparse doesn't take x1 from a env var, even though it is set
 
that needs 1. input, 2. expected output
 
And drop the use of the default config file, it is not relevant to your issue.
 
Is configargparse's default behaviour to read arguments from envvars?
 
1:20 PM
yes, according to the docs
 
I see
 
open console, type x1=330
run test.py
should see 330
I see None
 
configargparse docs: command-line, config file, env var, and default settings can now be defined, documented, and parsed in one go using a single API (if a value is specified in more than one way then: command line > environment variables > config file values > defaults)
 
@Hakaishin that does not define an envvar in bash, for instance
You'd need x1=330 python test.py, or export x1=330 and then run it.
$ x1=330 python foo.py
Namespace(x1=None)
I removed your camera.ini kwarg though
@Hakaishin Can you show in the docs where it says that it should use envvars automatically?
 
Thanks for running it. It's the first feature:
command-line, config file, env var, and default settings can now be defined, documented, and parsed in one go using a single API (if a value is specified in more than one way then: command line > environment variables > config file values > defaults)
Or how do you understand that feature?
I also tried setting a env var under /etc/environment in the hope it works like that, nil.
but if you get the same behaviour I will make an issue
 
1:32 PM
Side note: seems you should use parser.print_values() that will tell you where a value is coming from
p.add('-d', '--dbsnp', help='known variants .vcf', env_var='DBSNP_PATH')  # this option can be set in a config file because it starts with '--'
That's in the examples. The blurb at the top might mean that you can define an arg to be passed as both, and then it will look them up according to that order.
 
@AnnZen the simplest approach would be to rename the file, or to create a link to it using the correct extension.
 
later in that example:
If an arg is specified in more than one place, then
commandline values override environment variables which override config file
values which override defaults.
 
Hmmm, ok env_var="x1" did the trick. Strange. I thought it might be that, but pycharm didn't show any autocomplete
I don't get why env_var="name of the var" is not set by default
 
because automatically pulling in envvars is a terrible idea
 
I mean reading and executing 2 things is not the same. I guess you mean it's a security risk?
 
1:35 PM
You forget to pass an arg, but there happens to be an envvar with a compatible value. Now you have an unexpected Heisenbug.
 
hmmm, seems unlikely to me but then again I'm young :p
thanks for the help :)
 
no problem
 
Hello
I will be back soon
 
@MisterMiyagi you mean manually?
 
@AnnZen So you want to show a video without opening a subprocess? You would need some kind of Python video-playing lib. Searching for "python video player" turns up several promising links.
 
1:41 PM
I didn't say no subprocess, just not subprocess.Popen
mayby subprocess.call?
 
I seem to be misunderstanding your issue. Is there a reason why you don't want to use Popen?
 
wim
@MisterMiyagi is the unreachable code in the test code or in the code under test?
 
@wim test code.
 
wim
the idiomatic way is to call pytest.fail with a message explaining why it (should be) unreachable
 
nice, thanks.
 
1:47 PM
@MisterMiyagi I read a question where Popen doesn't work for them.
 
How do I render text with emoji in image?
I tried pil, opencv
 
There's emoji module.
 
but it can't render emoji on image in a text
emoji can be anything, it is not fixed which emoji it will be
 
perhaps it's for the better
 
xD
 
1:56 PM
I barely get help from here
 
@AnnZen okay. Did you try yourself? I use Popen regularly, in production. In fact, subprocess.call and others also use Popen behind the scenes.
 
I've tried os.system('FLVPlayer.exe %CD%\\video'), os.system('FLVPlayer.exe %CD%/video'),os.system('FLVPlayer.exe video'), subprocess.call(['FLVPlayer.exe','video']), subprocess.call(['video','FLVPlayer.exe']), os.system('FLVPlayer.lnk %CD%\\video')...
 
What's the command to run it via terminal? I don't have a windows box or FLVPlayer at hand, so can't double-check.
 
If I knew, then I can just use subprocess.call([...])
 
wim
2:08 PM
oof, 7 upvoters for calling eval on arbitrary user input
 
well, if they can call the program, they can run eval as well
 
wim
not necessarily
it could be a program which is whitelisted in sudoers
 
Sometimes a backend server will call a program to implement a user-requested function. Command line args could be collected from a web page.
 
wim
now 8 upvoters LOL
 
I was surprised at first to see so many votes ... but then i saw how old it was, that's very normal.
 
wim
2:12 PM
the answer is new, the question is old.
 
@PaulMcG Good point alongside wim's. readies the downvote paddle
 
Think you're the one who sent them another upvote?
 
wim
yep
 
XD
And a downvote!
 
oh my. there are some... interesting answers in that thread.
where does all this junk come from?
 
wim
2:15 PM
yeah, it's got "long tail of crap" problem. happens on many popular question.
 
@wim I believed you, but looked again, that answer's not new, at least to me.
 
wim
is 2 months ago on a 7 years old question.. that's new?
@MisterMiyagi I liked this users choice of variable name :)
 
Why was the message I starred gone?
 
@wim ha, that took me a second ^^
 
@wim at least some joy in all that missery!
 
2:21 PM
Example?
 
@wim Was that the example?
 
@AnnZen hey, I'd prefer if you just move on to another topic. I unstarred the message because it wasn't interesting, not for any sinister reason.
 
rbrb
 
wim
2:36 PM
@MisterMiyagi thankfully the accepted answer is a good one 😅
 
XDXDXDXD
 
@wim I still find that slightly smelly. A simple action='store_true' should be appropriate for 99% of cases. No need re-invent the wheel.
 
cbg
should I get 3.8.3? I got 3.8.1
 
wim
I had a use-case where store_true was not good - I wanted 1:1 parity with CLI and a config file, which was key-value based.
the foo_option = false or foo_option = true in config file does not map as nicely to --foo and --no-foo in argparse store action
I went with the approach of hpaulj in the end (i.e. "registering" a type "bool" in argparse)
 
2:45 PM
I'm also regularly part of the 1%. Wouldn't recommend it, though. ;)
 
wim
anyway the default behaviour of type=bool is kind of a footgun, don't you think?
 
I'll drink to that! raises coffee cup
 
@wim totally
Mind sharing your solution wim?
 
I'm talking about Python, by the way. I have version 3.8.1.
 
wim
It is already there on the question posted ... look for the answer from hpaulj
 
2:48 PM
"parsing bools in configs" is a sore point for me though. I cannot count the sleepless nights spent to figure whether this specific variant treats all of 0, False, false, FaLsE, nay, no, F, f, Fa, fa, Fa, ... as False.
 
Pressing F to pay respects to Miyagi
 
wim
F
 
I Fecond that
 
@AndrasDeak haha in my mind you are old, but you knowing the f meme makes you younger again, atleast 5years :P
 
wim
@AndrasDeak can you unfreeze MetaPython so I can air grievances without getting kicked again
 
2:50 PM
that puts me around 50 based on the age of that meme
 
huh it's from 2014 call of duty
 
@wim I'll get that done
 
wim
thank you
 
3:03 PM
@AndrasDeak wait, that means I'm dead, doesn't it?
haunts SO with votes and snarky comments Boo!
 
oj it takes some time for some stuff in python to sink in when learning
 
3:22 PM
the IDE not equaling the language is a common beginner issue with all languages
 
4:20 PM
Guys does the chr() return the UTF-8 or the ASCII? They show the function mentioning that is is for UTF-8 and then they give us a number and want they ASCII (the implemented solutions uses chr()).... but they have specified 1 min ago it is only for UTF-8
 
It returns a string (unicode)
 
yes but it is UTF-8 right?
You cannot write a function that accepts a positive integer with chr() and get the ascii character
or it can be any string as long as it uses unicode format characters?
 
utf-8 and ascii are encodings. They're used when encoding text as bytes. chr returns text. It has nothing to do with encoding
 
huh? its going to look up the unicode not the ascii value (assuming you use chr) so its going to return a string
 
Thanks for the link ill go read it
@LinkBerest aaaah so that means take a character back .. the encoding (UTF-8 or ASCII) is not relevant to the chr() function?
 
4:27 PM
ASCII is a subset of UTF-8
 
^ see above
 
Okie guys ill study your answers.
 
The answers are here to guide you. They are only the pathway. I would start with Googling "Python UTF-8"
 
@LinkBerest so if chr looks up the unicode not the ascii value how can a tutor be asking to provide a built-in function that takes an integer and returns the ascii character? Sorry for the persistence but i still cannot fathom it
@JossieCalderon i tend to do quite a searching before i ask a question. I consider my Python lvl low so some questions may seem obvious to other ppl stilll is vexing to be carrying the unsolved question in the mind
 
8 mins ago, by MisterMiyagi
ASCII is a subset of UTF-8
 
4:36 PM
@LinkBerest that means that the chr can give a character that is UTF-8 and not ASCII since ASCII is a subset
 
@ExoticBirdsMerchant That's OK
 
ASCII(subset...smaller) << UTF-8
 
It means if a function can handle UTF-8, it can also handle ASCII
 
Ohhhhhh Thanks!!! ahhh
Now i got it! You know i always found some explanations in books to vague
 
At this point you don't seem to understand encoding - 97 = 'a' in ASCII which is part of (but not all of) unicode (i.e. 97 still equals 'a' in unicode)
there are a lot of encoding methods though so there is not always a direct translation like this
 
4:43 PM
Because ASCII is a subset of UTF-8 and the chr handles UTF-8 it can also handle ASCII that much i understood. I ll read this wiki now. Thanks for the superfast direct help
 
@MisterMiyagi Thanks!! yours truly Daniel San
 
5:14 PM
morning cabbage
 
I've noticed, and track, a lot of new candidates having a lack of knowledge about encoding (and networks, memory allocation, really anything not coding based). I know the backend/data engineering focus makes me ask these types of questions more but still been marked recently
 
wim
pretty cool makelinux.github.io/kernel/map ... linux kernel map
 
I wonder at the cause (note current highest correlation is "coding challenge" site being given in resume or as "what have you been coding lately" answer in interviews so I do wonder about that)
that is awesome, wim
 
wim
@ExoticBirdsMerchant chr doesn't give a character that is UTF-8 nor ASCII. It gives a string, which is not encoded.
 
My understanding about char encoding and the chr was superficial that is why i could not understand it. A string is not a code point ... so it is not encoded
 
5:24 PM
whomever is starring everything which mentions encoding - please stop, its just over starring this area
 
thats me ... just marking my notes down
 
Note that stars are not just your own personal bookmarks, there is one communal starboard shared by all
 
sry didnt know that
 
You can probably use your browser to save permalinks to messages that you find helpful. Each posted message has a separate permalink, available in the hover menu to the left of each message.
 
u mean the permalink .... ^^ that is handy
 
wim
5:34 PM
star pollution!
 
6:18 PM
@MisterMiyagi Great Article ,, Thus was invented the brilliant concept of UTF-8. UTF-8 was another system for storing your string of Unicode code points, those magic U+ numbers, in memory using 8 bit bytes. In UTF-8, every code point from 0-127 is stored in a single byte. Only code points 128 and above are stored using 2, 3, in fact, up to 6 bytes. This has the neat side effect that English text looks exactly the same in UTF-8 as it did in ASCII.'' That says it all
So since the book was in english the guy setting the question was mostly using ASCII (1byte) however UTF-8 was implemented to cover ASCII and after one byte was exceeded other languages. 99% when we are talking about english characters however we mean ASCII
chr just gives the string if it belongs to UTF-8 or ASCII is another story ... hei hei hei
 
6:35 PM
I don't get it, how come every profile i click under the room tags, the profile is seen just-now - 1 minute ago?
 
@AnnZen What do you mean? Can you show some screenshots of what you are doing?
 
@AnnZen Probably due to a keepalive
 
Thats right or seen 50s ago. Cant be
 
7:25 PM
how can I use something like os.path.join() in a command line, particularly my command is like this from jupyter-notebook ( which doesn't work the command is interpreting the os.path.join string literally )

!python -m spacy init-model en os.path.join(modelpath, "spacy_word2vec", version, "spacy_word2vecmodel_"+ version)
if that's not possible I need to at least dynamically insert the version number into the command line arguments
 
is there a reason why you don't just use subprocess?
 
i'm not aware of subprocess, can I invoke this from jupyter-notebook?
 
why are you using a jupyter notebook for something like this?
I love these for visualization and exploration but notebooks are not always the best environment
 
my team is reluctant to use anything else
 
7:32 PM
shrug then you can use magic commands to run these type of things directly or subprocess as already suggested
 
 
1 hour later…
8:47 PM
Is there a lib for generating html from Python objects including literals?
I had created this a while back: github.com/aaronchall/HTML5.py
 
9:02 PM
Django kind of does this, but it works at a higher level than mapping HTML tags directly to Python classes.
 
I want very precise control. I think I may need to use my little package (once I get it rewritten for Python 3...)
 
9:23 PM
Maybe that's why people prefer templates. Then they don't need to learn a Python layer on top of html.
But since I have my layer and I already know fundamentally how it works, then I have the value of working with Python and having 100% of the power of it...
This is where I expect Wim to jump in and tell me I'm stupid....
 
want me to do that for you? :P
 
Yes.
 
@AaronHall don't be stupid
 
Please elaborate! :)
 
that was not part of the bargain!
 
9:33 PM
I'm sure Wim will elaborate later...
 
hopefully ;)
 
We will hope.
 
wim
9:52 PM
there are already some mature libraries for generating hyperlinked docs from docstrings
for "Python objects including literals" I'm not really sure what your scope is here
Django models don't have much in the way of magic to serialize to html, you still have to write the templates yourself
 
@wim see the README of the project I linked to for an idea about scope, or better yet, the __main__.py for an example: github.com/aaronchall/HTML5.py/blob/master/html5/__main__.py
 
10:08 PM
@wim I was thinking of Django forms. For a basic form with inputs for each field in a model, Django magic just generates it for me.
 
wim
@AaronHall hmm, what is there to gain vs just writing HTML directly?
 
The little I have peeked into the Django template engine. They appear to be a pretty straightfoward parser that generates Python objects that in turn spit out HTML. It shouldn't be difficult to just create the Python objects directly.
 
wim
Django template language is intentionally very simple
they keep it that way so that you are forced to put logic in code, not in template
for people that don't like to use such good practices, there is jinja2 ;)
 
10:39 PM
rbrb
 
11:29 PM
Goooodnight
 
11:52 PM
cbg. Regex question: I've read the regex doc through, but is there no length operator in regex syntax to compute the length of a capture group e.g. \L of \1? Assuming no, I have to use a callable in the replace arg which references len(m.string). (I'm trying to replace multiple instances of 'http(s)?://....' with the replacement string 'URL ' and also pad that replacement string with spaces, to the same length as the origimal, to preserve indices before-and-after)
 
you do need a callable, but not len(m.string) - you need len(m.group(1))
 
FYI the most complete, language-agnostic regex tutorial I found is Regular-Expressions.info by Jan Govaerts
@Aran-Fey Yes thanks, I had gotten it woeking already. Just asking whether any length operator exists? (my vague PERL memories are that one might have existed, but probably as a PERL function rather than a legit regex expression)
 
nope, regex rarely has any operators (some have uppercasing/lowercasing), but python's has none
 

« first day (3523 days earlier)      last day (1418 days later) »