« first day (3386 days earlier)      last day (1787 days later) » 
01:00 - 21:0021:00 - 00:00

01:06
Feels like every new WINE version has "big improvements for gaming" nowadays, yet still nothing actually works
 
3 hours later…
03:52
hi
this is my code
train1 = pd.read_csv('train.csv', iterator=True, chunksize=150_000, dtype={'acoustic_data': np.int16, 'time_to_failure': np.float64})
X_train = pd.DataFrame()
y_train = pd.Series()
for df in train1:
ch = gen_features(df['acoustic_data'])
X_train = X_train.append(ch, ignore_index=True)
y_train = y_train.append(pd.Series(df['time_to_failure'].values[-1]))

pd.options.display.max_columns = None
df = pd.DataFrame(X_train, columns=[ 'mean','std','min','max','kurtosis','skew','quantile0.01','quantile0.05','quantile0.95','quantile0.99','absmax','absmean','absstd','peak'])
------------df.head(10) is not displaying the records in respective columns .instead it is displaying NaN in each row of the column. how I can display the records in column?
 
2 hours later…
05:59
Facing List Index out of range error in below code:
```
palette = sns.color_palette()
cluster_colors = [sns.desaturate(palette[col], sat)
if col >= 0 else (0.5, 0.5, 0.5) for col, sat in
zip(clusterer.labels_, clusterer.probabilities_)]

plt.scatter(array(selected_data2).T[0], array(selected_data2).T[1],c = cluster_colors ,**plot_kwds)
```
Have you tried
pd.set_option('display.max_columns',50)
 
1 hour later…
07:30
Please help me with that : pastebin.pl/view/1be6acb0
07:44
I solve the problem with this : stackoverflow.com/questions/22507592/…
 
1 hour later…
08:49
@Aran-Fey I'm pretty happy with it on MacOS. Then again, most of my games are at least 5 years old.
 
1 hour later…
user10984358
10:07
the new version supports MacOS again? I was forced to ditch Wine and games when I upgraded
10:23
@TheNamesAlc I use PortingKit, which is a nice frontend for automatically setting up WINE. Works quite well.
cbg guys, I am reading the django documentaion here docs.djangoproject.com/en/3.0/topics/class-based-views/… under the dynamic filtering, I am trying to use the example of the PublishBookList views.py. Could someone explain where the 'publisher' string comes from in line 7. where:
self.publisher = get_object_or_404(Publisher, name=self.kwargs['publisher'])
I meant the list in the kwargs. Thanks
10:41
@superv The urls.py has publisher as a parameter, which it passes on to the class based view, which in turn sets it into the self.kwargs attribute (probably during class initialization). So, it is guaranteed to be there since the url has it as a compulsory parameter.
@superv It's not a list, it's a dictionary.
11:31
Thanks @shad0w_wa1k3r
you're welcome
11:56
Hi guys, new python user here, working on a new project and got the following problem: stackoverflow.com/questions/59869001/…
@Leon Hello Leon, welcome to the Python chat room. We don't discuss new questions (< 2 days old) here, the main site is good enough for visibility.
@shad0w_wa1k3r Alright, I was hoping that on the chat solutions can be discussed more in-depth. That way i'll learn actually more from it :/
If the discussion is better off on the question / specific answer, then please do it there (for the benefit of future users). If it's more general or relatively basic, then you may ask it here.
@Leon And of course, anything that you may want to discuss in-depth (too deep for the question / answer) is also welcome.
@Leon Note that you may want to clarify your problem (edit the question). It currently is very hard to understand what you need.
Thanks for the tips guys @MisterMiyagi @shad0w_wa1k3r
@MisterMiyagi I'll do it right away.
12:09
i have a python dictionary key keys like x.x.x.x and I want to create a list of of all ips of the pattern *.*.DD.* where DD is some digit which i know.
In [7]: for ip in ips.keys:
...: if "*.*.49.*" in ip:
...: print(ip)
...:
obviously this is not a correct way but close to what regex i want to use
so use a regex
or use an IP address library
@MisterMiyagi Edited, is it easier to read and better to understand my problem now?
@Leon Some things to consider: You say your data is CSV, but show a dataframe and list-of-inputs which are completely different. You use some terms/phrases that don't quite fit, e.g. "upload an excel file" (to the web? where to? do you just want to create one?) and "make a function iterable" (it's not a function anymore then).
Also, keep in mind that "asking multiple questions as one" is discouraged. There is a close button for exactly that, and people will not hesitate to push it.
user10984358
@pythonRcpp quick but a better way exists [i for i in ip.keys() if i.split('.')[2]==DD]
@MisterMiyagi I rephrased my question. It might look like more than one question, but they are all connected. Just loading the inputs wouldn't do much.
12:18
ok i tried re.compile("^\d{1,3}\.\d{1,3}\.\49\.\d{1,3}$")
@TheNamesAlc very nice ... smart
user10984358
@pythonRcpp you should see what others here would say :) what is wrong with a regex based solution? I havent tried yours out
@TheNamesAlc s=re.compile("^\d{1,3}\.\d{1,3}\.\49\.\d{1,3}$") ; s.match("10.42.49.11") gives nothing
my bad there is a backslash wrongly given
let me try again
works perfectly
thanks for the help guys
user10984358
without the r prefix?
ya i just gave s=re.compile("^\d{1,3}\.\d{1,3}\.49\.\d{1,3}$")
@Leon The point is that asking questions at SO is not about solving someone's entire task. It's about solving a specific, isolated problem that is applicable in general.
user10984358
12:23
well if it works it works, i always prefix regex with r, thanks to this chat room
@pythonRcpp I suggest using raw string literals when you have regex patterns with backslashes
@TheNamesAlc not regex. Raw.
user10984358
I meant regex as the string that acts as a regex, but I can see the wording I did :/
ah, no, I just misread, sorry
ok changed to s=re.compile(r"^\d{1,3}\.\d{1,3}\.49\.\d{1,3}$") thanks
@AndrasDeak or any other pattern with literal backslashes, of course
12:32
@pythonRcpp That's much better. Using a normal string (instead of a raw string) works because \d and \. aren't standard escape sequences. However, recent versions of Python will give you a DeprecationWarning for stuff like that, and a future Python version will treat such things as an error.
ok noted
hi ....
is there any way we can run python in java without using exe installation ?
like adding some libraries that will help to connect
Like running python commands inside the java code as run time and produce the output..PIP commands
Any suggestions please ?
Wait, you want your program to work without the user having python installed, and yet you want to run pip commands? What's the point of that?
shudders
12:39
> The current version of Jython is 2.7.1 It can be downloaded here:
Hey guys, I'm staring myself blind on this silly issue. Can anybody see the issue?

I'm running this. I've checked, each of the self.box_ are integers ( as they should be)

size = 1000
distance = \
( abs(self.box_a_x1-self.box_b_x1) + abs(self.box_a_x2-self.box_b_x2) ) / 1000 \
( abs(self.box_a_y1-self.box_b_y1) + abs(self.box_a_y2-self.box_b_y2) ) / 1000

/home/rootadmin/opensurfaces/server/shapes/models.pyc in save(self, *args, **kwargs)
1947 distance = \
1948 ( abs(self.box_a_x1-self.box_b_x1) + abs(self.box_a_x2-self.box_b_x2) ) / 1000 \
what's the value of abs?
also could you please format the code? Take a look at formatting guide to code in chat
the build-in function that returns the absolute value
12:44
But i think miyagi already nailed it. Check if abs hasnt been overwritten by accident.
@MitchellvanZuylen Are you sure?
Ah..wait, of course
Didn't even consider that
Okay, I have gotten a very good idea of how descriptors work, and I must say that I absolutely love'em!
Though I got a "design question" in regard to descriptors. Would it be wise to create a "descriptor" file in which all one's descriptor classes should be located? So that, whenever you want to reuse a descriptor class, you just import the specific descriptor class from the descriptor file.
like a library, you mean?
Uhm, yea
Sort of
I guess
I mean the descriptor classes is going to be specific to the specific project, but I guess you can call it a library still.
12:52
I figured it out. It wasn't the abs function. I was simply missing an operate after my line continuation. I was basically doing (a)+(b)(c)+(d)
Would it be wise to create a "classes" file where all your classes are located? Maybe, maybe not. Depends on the classes. Same thing goes for descriptors.
@MitchellvanZuylen read the error message with the benefit of hindsight
@AndrasDeak Yeah, exactly. The error is always right
Just so you know what to look for next time
13:19
cbg guys o/
What's difference between these two expressions:
(a - 1) // b + 1
and
(a - 1) // (b + 1)
order of operations is different. you know about operator precedence yeah? multiplication and division are higher up compared to addition
(a - 1) // b + 1 is equivalent to ((a - 1) // b) + 1 because of order of operations
Check this:
>>> (24 - 1) // 4 + 1
6
>>> (24 - 1) // (4 + 1)
4
Hello guys, I would like to parse through a csv file and export it afterwards to a dataframe. Initially when I open the csv through excel everything is stuck together with delimiters. I want through python to make an automated process that gives a nicely structure dataframe. Do you have any tips or standard code you are using? I have been looking online and I cannot find something well explained to use. I am new in python so any tips would be useful.
@TheLittleNaruto that's how it should be.. deep breath This is the way.
13:23
Right! Thanks @ParitoshSingh @Aran-Fey
You can kill me now.
@Vasilis Anything wrong with pandas.read_csv?
Since descriptors is intended to be used on class attributes, what would I use if I wanted the same kind of functionality for an instance attribute?
In other words, what is the "equivalent" of a descriptor for instance attributes?
There isn't one AFAIK
Can you clarify what kind of behaviour an "instance descriptor" would have?
Well, that's a bummer
13:28
moving from Y land to X land are we? :o
The same as a class attribute, it can just be used on instance attributes, @MisterMiyagi
A descriptor is stored as a class attribute to change the behaviour of instance attributes. So a descriptor stored as an instance attribute would change the behaviour of -- what exactly?
Note that descriptors are implemented by __getattribute__, so you can always invent your own descriptor'ish protocol if you want.
@Aran-Fey: This is the error I get from using pandas: ParserError: Error tokenizing data. C error: Expected 2 fields in line 5, saw 4
I'll have to think about that for a second ..
Sounds like your csv file is b0rked. You'll probably have to preprocess it before you can parse it
13:32
I just import the library and then do: data = pd.read_csv(file.csv)
Any advices on that?
your technique on reading the csv was fine. your csv itself seems to be messed up.
eyeball your csv by opening it with any text editor like notepad
anything about it look wrong to you?
specifically, if the delimiter is a comma, do all rows have equal number of commas?
@MisterMiyagi, but a descriptor doesn't change the behavior of instance attributes, it only changes the behavior of class attributes.
(So I think)
Datum;"Checkin";"Vertrek";"Checkuit";"Bestemming";"Bedrag";"Transactie";"Klasse";"Product";"Opmerkingen";"Naam";"Kaartnummer"
08-01-2020;"15:02";"";"";"New York";"1 56";"Toeslag Intercity Direct";"";"Dal Voordeel (2e klas)";"";"name";"4628"
these are the first two lines of it
I see it has some empty values
@SebastianNielsen it can do both
class Descriptor:
    def __get__(self, instance, owner):
        print('descriptor called')

class Foo:
    desc = Descriptor()

Foo.desc  # descriptor called
Foo().desc  # descriptor called
But you are in both cases accessing a class attribute, not an instance attribute, @Aran-Fey
13:44
@Vasilis it advises you to recheck line 5
desc is a class attribute, not matter if you call it from an instance of a class or from the class itself.
Wouldn't you agree?
Yes and no. Attribute access is a bit complicated
I am sorry, but aren't we dealing with a yes/no question here. Either Foo().desc is a class attribute, or it's not.
Likewise with Foo.desc
Depends on your definition of "class attribute". Yes, in both cases python finds the desc in Foo, so in that sense it's a class attribute. But with the code Foo().desc you're still looking up an attribute of an instance, so in that sense it's an instance attribute
I need to go now, will catch up later
13:51
cbg all
@Dodge, @PaulMcG are you guys planning on PyTexas this year?
Ahh, I see, so it isn't like in Java where class attributes only belongs to the class. @Aran-Fey
@toonarmycaptain possibly. if I go I may opt to volunteer like you did last year to be more involved. I just sat and listened last year and, although nice, I don't think I got as much as could've out of the trip
@MisterMiyagi, so wanted I wanted to say before is that it is weird to have **class attributes** act as if they were **instance attribrutes**.

Example:

class Car:
	number_of_wheels = IntegerGreaterThanTwo()   # **class attribute**

car2 = Car()
car4 = Car()
car2.number_of_wheels = 2
car4.number_of_wheels = 4
print(car2.number_of_wheels)   #output: 2   #If a descriptor wasn't used both would
print(car4.number_of_wheels)   #output: 4   #be 4, as we are dealing with a class
                                                                 #attribute.
Do you see my point?
That's why I wanted to use the descriptor on a instance attribute, one inside a __init__ in the form of something like: "self.number_of_wheels = IntegerGreaterThanTwo()".
I dont really get this convo so far. First, if a descriptor wasn't used, why would both be 4? (sidenote, i have no idea what's descriptors) . You literally assign 2 for one object, and 4 for another. that's going to give 2 and 4.
Secondly, a class is a blueprint for objects. What you do on the class has a direct impact on the instances, because instances were intended that way. I don't get the convo because i keep being stuck on that mental model. Could you elaborate it from that angle?
14:07
Oh wait, I am so sorry, you are right. I thought class attributes in python acted the same way as those in Java.
Wait, if class attributes in Python doesn't like those in Java, what is the point of them? I am so confused right now. I'll go and read up on class attributes in Python now.
thank you for your help guys, the file had an issue, it works with other files!
14:20
@SebastianNielsen Descriptors are class attributes, but they change the behaviour of instance attributes. They are a generalisation of slots/fields.
Basically, Class.foo defines the meaning of Class().foo.
Okay, I am starting to get it now. My problem was I thought of class attributes in python as automatically being static.
In a Java/C++/...-like language, classes have fields - e.g. Class.foo: Int - which define the attributes of instances - e.g. Class().foo = 3. But the field and attribute still are distinct.
Descriptors are similar, but first class and more generic. They encode behaviour, not just type.
Hey guys, I have a problem:

I have a function that has two input arguments: 'date' and 'symbol'.

def function(date, symbol)
...
return [data]

I can call the function for different input arguments like this (different symbols and different dates):

inputs = [('date', 'symbol'),
('date', 'symbol')]
for inputs in inputs:
print(get_data(*inputs))

Now imagine I have a dataframe that has two columns, first column are symbols, second column are dates.
Symbol Date
0 symbol date
1 symbol date
So you are looking for the equivalent of get_data(*inputs)) but reversing inputs?
Correct, instead of manually passing a date and symbol, I want to pass rows of a dataframe as inputs
14:30
@Dodge Sounds good :) I enjoyed chatting with the speakers in the greenroom, that's for sure.
@Leon Since the only purpose of function seems to be translating the data frame -- why don't you just reverse its arguments? def function(symbol, date):
Sure it's possible to reverse each row on call, but there doesn't seem any need to pay the cost of that.
if absolutely necessary: may be just reverse the ordering of the dataframe? df[['Date','Symbol']].apply(...) @Leon
function does not translate the dataframe. It returns different data (not important for now).
@SebastianNielsen That's exactly what descriptors can't do. Like dundermethods, descriptors only affect instance behavior if they're defined on the class. A descriptor that only exists on the instance has no effect
@Leon Just pretend the word "translating" didn't exist in my message.
14:41
(Except if it's an instance of type, i.e. it's a class)
@Aran-Fey That's actually precisely why dunder methods don't work when defined on instances. As far as Python is concerned, a proper method is a descriptor. The rest are just callable attributes.
Huh, really? So if you use a callable non-descriptor object as a dundermethod, it won't work? Interesting
So what I have just come to realize is that Python class attributes works exactly like instance attributes when you set a default value for the instance attribute. So these two versions does the same (perhaps not internally, but you know what I mean I suppose)

class A:
	d = 4

class A:
	def __init__(self, d=4):
		self.d = d
@MisterMiyagi Sorry, I am not following you.
For instance, not matter what "class A" version you choose, you will get the following result when you run:


a = A()
a2 = A()
print(a.d) # 4
a.d = 2
print(a.d) # 2
print(a2.d) # 4
Since the two "class A" versions are equivalent, which "class A" version should you choose?
wim
wim
14:49
@MisterMiyagi PEP 549 -- Instance Descriptors
(Rejected for python 3.7)
@Aran-Fey Getting into pretty murky waters here. ^^ A callable on the class will work. A callable on the instance will not.
why do people need to use a segment tree?
@wim missed that one. TY.
15:08
is there any way to access the __dict__ slot from Python? Both type.__dict__ and object.__dict__ invoke it directly.
Basically, the way that object.__repr__ gives a <slot wrapper '__repr__' of 'object' objects>, I'd like the slot for __dict__.
15:33
d = collections.defaultdict(set)
is there "set" bit some special parameter
?
set is the set type
It means that every reference to a previously-unreferenced key will init with a set()
So you don't have to do all the clunky "if the key isn't already there, create an empty <whatever>"
And you could init with any type or method that takes no arguments.
Typical types used are int, list, set, but it could also be `def my_method_that_inits_with_a_random_number_of_ints(): return [randint(1,100) for _ in range(randint(1,100)]
defaultdict(my_method_that_inits_with_a_random_number_of_ints) is how that would be used
Cbg
sorry what would the difference with int and list be
?
defaultdict(int) will init new values to 0. Great for tallying up counts (or use Counter, which is a suped-up version of defaultdict(int))
15:40
so defaultdict(set) will init new values to a set?
tally = defaultdict(int)
for c in "SLFJLSDKJFLSKDJFLSDKJF":
    tally[c] += 1
Yes
So you can just do for key, item in some_list: accumulator[key].add(item), and not worry whether you previously initialized the key with an empty set - defaultdict does that for you
locns = defaultdict(list)
for loc, c in enumerate("SLFJLSDKJFLSKDJFLSDKJF"):
    locns[c].append(loc)
This will give you the list of all locations that any character is found in that string.
locns.keys() would give you the list of unique characters.
The argument passed to defaultdict is sometimes called a factory method, because it is the method used to construct new elements by calling its no-argument default constructor. Python being Python, you can pass any callable that takes no args here, including a class, as long as that class has a meaningful no-arg constructor, or one with all named args with defaults.
This is also an example of dependency injection, which we used to call the Hollywood Principle - "don't call us, we'll call you". You pass the method into defaultdict, and the code in defaultdict will call it when it needs it.
I just wish there was a defaultkeydict, which would take a method that gets called with the key that was never seen before and so caused the factory method to be called. Not superdifficult to write, but as long as defaultdict is there, defaultkeydict would be a nice minor variation.
@SebastianNielsen They're not equivalent if d is a mutable object, like a list. As soon as you do A().d.append(x) you'll notice a difference between the two approaches
15:57
@arjan That would make a superb question, please go ahead ask it on SO. (You could self-answer if you want to.) Also, I tagged that question, , since it's search resistant. Would/should we also use the term/tag ? FYI there are 274 Python questions also tagged operator-overloading
...Also is it worth distinguishing between operator overloading in 2 vs 3?
Hi everyone, I'm new in python, and I need help for a code. Can you guys help me?
@smci ??? was there a difference in op-overload going to 3? I don't recall running into much, and I use op-overload quite a bit.
I have this dataframe and I'd like to select some words in 'text' and return only the dataframe with the words that I want
id   city      name     text
1    Boston    Rosie    I have some text here, as you can see.
2    New York  Liza     I love my cat
Though I scraped Py2 off the bottoms of my shoes a few years ago now
@HugoB At some point, if you are doing word search vs. in text search, make sure you split text to search for whole words. Else you might match a row 3 Troy Achilles I love my catapult if you do string-in-string searching for "cat".
16:16
Quick "programming-grammar" question, do you say:

1. The class attribute is stored **in** the class.

or

2. The class attribute is stored **on** the class.
tbh I say both
@PaulMcG I have already tokenized, but I cannot use something like: df['name'][df['text'].str.contains("cat&love")]? the & gives me empty result
I don't know pandas too well - will contains accept multiple strings? like df['name'][df['text'].str.contains("cat","love"). Of course then the question is, would mulitple strings mean 'and' or 'or'?
This might work, but perform poorly: df['name'][df['text'].str.contains("cat") and df['text'].str.contains("love")]
And I must say str.contains sounds an awful lot like string-in-string searching, not string-in-list-of-tokens searching.
And cat-lovers and catapult-lovers may not have that much in common
I see. For now thanks!
@Aran-Fey Ugh, no, with this setup they are equivalent. The second case stores the default on the method, which is unique just like the class.
16:26
On the method? What method?
A.__init__
The attribute isn't stored on the method, though. It's stored on the instance
class A:
	d = 4

class A:
	def __init__(self, d=4):
		self.d = d
Take a look at A.__init__.__defaults__ ;)
The default value is stored on the method, if that's what you mean
Ah. If d was a list then using it as a default value would be a problem, that's true
But in the general case, it matters whether you store something on the class or the instance. I.e. these are not exchangeable:
class A:
	d = 4

class A:
	def __init__(self):
		self.d = 4
yeah, stuff also blows up if d is a function
16:33
Sep 16 '19 at 20:05, by holdenweb
@inspectorG4dget "Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out." https://wiki.fysik.dtu.dk/ase/development/python_codingstandard.html#python-coding-conventions
late morning cabbages, all
@PaulMcG Yes I wasn't saying the language syntax had changed in that regard from 2.x to 3.x. I meant to say "Are there changing trends in whether code (esp. third-party packages) these days doing overloading?". For example that whole chaining idiom (which is a big recent trend in the last decade in R with dplyr's %>% and tidyverse; it's now become the dominant programming idiom in data science in R. But not in Python)
I've seen >> used for monads frequently. Even if the authors didn't know those were monads.
16:52
is it just me or are leetcode questions really hard?
The number of times I've googled "monad" steadily goes up while my understanding of monads consistently stays at nil
@PM2Ring Just belatedly saw that discussion between you, JennaSloan, Aran-Fey about WET vs DRY coding and sprinkling input() calls and arg-parsing logic in code solutions used by HackerRank et al. Yes that code is nasty, repetitive, brittle, and tends to throw errors unless the expected input exactly follows a precise specification, which is to say it's just about ok for those specific coding challenge formats, but for everything else is bad form to learn...
...So yeah it would be good to have some article about "What bad programming practices do HackerRank (or other specific coding challenge site) solutions teach, and how can you unlearn them?" (in the past I would have said "...an article on SO", but based on things recently, nope)
17:16
@smci It'd make a good topic for a blog article, but I don't know how well it'd fare as a SO Q&A. Code contests are ok for established coders, but those oddball coding structures they encourage are probably not a good influence on newbies who have virtually no idea of what good coding style looks like.
On a related note, I almost always write my Python code with a main() function and an if __name__ == "__main__" guard. We rarely do that stuff on SO answers though, since we're trying to focus on a single problem. But that may be giving newbies a bad impression of what good code should look like.
I particularly hate that coding contest which forces you to wrap your code in a class. But I probably mentioned that in the conversation you're referring to. ;)
Doesn't everything have to be in a class? ducking and running
The Curse of the J-Language
17:56
@PM2Ring oh dear. Count me a victim of bad impression :P
@PM2Ring it's almost never complete code we write
it's distracting fluff on SO
18:16
Will we run out of version number for python3? It's already python 3.9 now.
ain't nothing wrong with 3.10
is 3.9 out?
@Aran-Fey ok. you are right..
@whatsnext Still a good question, when there is naive code that does incorrect version number validation
'3.10' > '3.9'
Out[9]: False
ah, so not yet. ty
18:25
@PaulMcG At least that's reasonably fixable rather than jumping from 3 to 95... to 2000 then to 7 :)
2000 was internally represented as '9X' I believe
I'd have thought there'd be something standard in pip/setuptools/distutils whatever for numbered version checking
There is. I was talking about naive code doing just straight string compare against sys.version. Even sys.version_info gives a nice tuple of ints, so that comparison will work.
sys.version
Out[11]: '3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]'
sys.version_info
Out[12]: sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)
tuple(sys.version_info)
Out[13]: (3, 6, 8, 'final', 0)
Please, no abuse about running on 3.6.8, I'm at work
I've still got something running on 3.4 and a couple on 3.5 - I think it'd be rather hypocritical of me :)
@AndrasDeak Well sure. We know that, but the newbies (probably) don't.
18:33
cbg
I see refs in that whats new in 3.9 page to some features that are being deprecated in 3.9 that are planned to be dropped in 3.11.
There's packaging.version.parse stackoverflow.com/a/11887885/4014959
@PM2Ring Yes I very specifically said 'article', nothing about SO.
@PM2Ring Also true, I don't know if it's worth explicitly noting though.
Sorry, I am a newbie. How can I improve my Python? I am currently reading the source code of some python packages, like sklearn, airflow, pytest, and so on. Are there any well-written Python packages that can be helpful to have a deep understanding of python3?
I didn't see that part (link?), but yeah many coding-challenge sites impose
strict and quirky requirements which are doing newbies a serious disservice. Hence I idly commented an article covering those might be useful. (I was trying to help a friend user HackerRank last night, and the IO boilerplate code their challenges need is annoying as hell)
18:42
@JonClements Don't forget 98, or Windows Me. On second thoughts, maybe we should forget that one. :)
Oh gawd... the memories.... the.... the... tony the pony he cometh!
@AndrasDeak (and everyone): new user Alexander seems to be trying hard but finding it difficult posting questions on SO... should we invite them here briefly to give them some suggestions about how to ask questions?
Oh! I think it was Windows ME (Millenium Edition) that was 9X internally, as in 90 + Roman numeral X -> something more than 95 and 98.
@PaulMcG That's not X as a Roman numeral though, it's only X as placeholder for a (single) unknown digit, intended to signify "will ship by 1999"...
Perhaps it is base 34
18:47
@smci Alexander is hardly new. He has 3111 rep, and has been a member longer than I have. But feel free to invite him here, if you think we can help. Or create a room.
@PM2Ring How do I invite? just namecheck them here? or post a comment on one of their questions?
@smci No. That won't work. Just use a comment on one of his posts.
@PM2Ring Ok. (Just some of their questions keep getting deleted/self-deleted...)
Mods have a "superping" power to summon people to chat, but that's normally reserved for Serious Business.
@whatsnext I find reading raw code very confusing without some high-level design diagrams giving me an overall roadmap - I just don't have a good idea where to start, or what modules/classes/methods are very important vs. those that are just used locally as shortcuts or helpers.
18:52
Speaking of rooms, I just noticed our MetaPython room got frozen for inactivity. I guess we should ask a mod to unfreeze it at some stage.
Was that even really used for anything?
@whatsnext I was just on our chat room wiki, and found this page: sopython.com/wiki/What_tutorial_should_I_read%3F
@PM2Ring We can get it unfreezed when the need arises
@JonClements Not really, but I think it would be nice to keep it. We did plan to use it for room meetings.
@PaulMcG Right, they usually don't have any design diagram. I also want to see how others using python in practice and how they build a relatively large system using Python.
18:55
We use to have a room for meetings which kept getting frozen and then decided it was too much faff and it was just better to hold 'em here did't we?
@AndrasDeak Do frozen rooms get deleted if they stay frozen for a long time?
@PM2Ring no they don't
@JonClements Oh, good.
cbg guys. Apart from the Django official, is there a good tutorial that good more in-depth? Thanks
more in-depth regarding... ?
18:58
@JonClements Well, it was supposed to be used for discussing room policy stuff, and as a temporary measure for people to air grievances, in lieu of having a private way to complain about policy & actions by ROs...
@JonClements Well, most tutorial I have seen and even those from the documentation uses two models for example. I feel that doesn't help if you want to build complex applications with many models.
@superv have you done any database modelling in general?
Yes, but albeit briefly. Does my lack of experience affect ?
@superv possibly... if you're comfortable modelling something in a relational database with an ORM - then you'd do the same things as you would do with an ORM - but you'd just need to learn how to express to the orm what you'd do in the DB... if you don't know how to model a relational database to start with - you're going to be at a severe disadvantage...
19:08
@JonClements I guess you are right as it was a bit difficulty when I was designing the model for the application I am building. As I am limited on that, I could not thoroughly go through a tutorial on databases. I guess I should find time for that.
FYI all, HackerRank is still defaulting to Python 2 not 3 :( No preference for 3, no warning if you try to use 2, no plan to sunset or warn users. Depressing. I dropped them a note.
19:34
@smci Leetcode is defaulting to python3
@whatsnext Ok so we don't do public shaming, but it's worth prominently noting which coding sites and forumz still make Python 2 the default in 2020... or at least praise the ones that default to 3... I suggested to HackerRank they lock forums discussing the Python 2 solutions
reading the CEO's blog was kinda weird...... I read the thing but came away with little to nothing... am I the only one who felt that way ?
I have a function with multiple arguments. When calling the method, at least one of the argument value must be passed. What is best way to achieve this?

For example, I have a method something like this:
def print_any(log1, log2, log3):
    # here it should throw error if any of argument doesnt have value
    # OR
    # print the variable with the value
@MooingRawr Everyone felt that way. It was conspicuous by the glaring events that were (very intentionally) not mentioned, and the drenching of lawyer/corporatespeak like "better align with the community". SO Corporate's KPI have by now diverged from SO Community.
19:41
I just want to avoid many if-elsif-else
@TheLittleNaruto Not clear on your requirement. "any argument doesn't have a value" sounds like they are all required. But you description says "at least one must be passed", so that sounds like 1 or more must be passed. Which is it?
def print_any(*args):
    print(random.choice([arg for arg in args if arg]))
And how will someone pass log2 if log1 has no value?
@PaulMcG Only one.
@PaulMcG TheLittleNaruto means "at least one of the args must be defined"
19:43
Only one, or at least one?
I think @TheLittleNaruto wants to default each arg to None
Yeah
@PaulMcG Only one among all
And that can be any one, either log1 or log2 or log3
I also don't wanna drag the room's emotional state down or take away from active conversations, but I would say I'm shocked at shog and Robert's departure... I wonder what the future place to hang out for programmer / programming needs would be...
def print_any(log1=None, log2=None, log3=None):
    sum(arg is not None for arg in [log1, log2, log3]) == 1
@TheLittleNaruto a) Do you care about the default value for each arg if it is not passed? Or just default them all to None? b) Do you have a specific fixed list of args ('log1, log2, log3'), or could that extend in future (log4, logdict...?) c) Do you want to pass args by name, by position, or both?
19:46
Will ensure that one and only one will be given
If you want one or more, change == to >=
@PaulMcG Nice trick there! Thanks
@smci a) default should be None if not passed. b) Yes, there are 5 args. c) args by name
@MooingRawr I see two separate questions: a) does SO deserve our ongoing participation and monetization? b) whither to? It's extremely possible to decide the answer to a) is 'No' without having a great answer yet to b)
@TheLittleNaruto Maybe add a comment would be good
# make sure one and only one log is given
Yeah will do that
Melon again :)
@MooingRawr No, you're not the only one. His MSO post is slightly better, and it's nice that he responded with comments to some answers. I expect there will be further responses to those answers, but it will take time to digest everything posted there and to formulate an appropriate response. Also, he invited Aaron Hall to a face to face meeting, and it will be interesting to hear what comes from that.
19:50
I'm curious about the body of print_any. Do you really do different things with one log vs. another?
No, That I took as an example to make you understand my problem statement
Ok - generally speaking, if you find yourself writing code with lots of entries named x1, x2, x3, etc. you might consider using a list of elements instead.

(He says while looking at some code he is writing *right now* with variables named `policy_1`, `policy_2`, and `policy_3`!!!)
In real, I have a method called find_user which can have multiple args like id mobile or email and in the method I will make a query to the database based on received arg's value
@PaulMcG Noted!
I am feeling drowsy, it's already late night here.
Rhubarb o/
@MooingRawr Perhaps Codidact, but that won't be ready for a while. They aren't trying to clone Stack Exchange, they want to create something better. But they do intend to import content from Stack Exchange, and allow people to associate themselves with their Stack Exchange content. You won't inherit your Stack Exchange rep, since their rep & privileges system will be different, but there will probably be something like an association bonus.
@PM2Ring Yes that's what some people have decided on. As to the content: "License, baby, license!"
20:02
in Tavern on the Meta on Meta Stack Exchange Chat, yesterday, by ArtOfCode
If you're interested in what the vision for Codidact is, have a look at this thread (I'd recommend hitting the Summarize This Topic button, otherwise it's... long)
@TheLittleNaruto Ah ok, you want a find() method that accepts multiple different cases of field to search on.
@TheLittleNaruto Drilling down, show us the underlying query syntax the database accepts. Does it have an ORM? Does it not already have query() methods that accept multiple args anyway? Your function might be unnecessary layering on top.
@TheLittleNaruto Consider using SQLAlchemy, it accepts multiple query syntaxes.
20:17
Oh Arron is that famous eh. Interesting. :D I'm okie. as long as I can find most of my (what do I call you guys? Friends? Co Snakers? idk I will use friends) friends from this site, then I'm good.
20:30
Would you agree that this answer deserves a flag for spam? As it doesn't disclose the author's affilication stackoverflow.com/a/6304151/7123519
It got (20 upvotes) somehow though
@TheLittleNaruto no wonder I don't see you around 15 anymore. Traitor :)
why do people you cython (with the gil) if the jvm implementatoin jython doesnt have a gil?
@SebastianNielsen I don't think so. I've always thought that's more for paid things or tools. But a blogpost not disclosed I don't think is a big deal
Although, it's very close to being a link only answer (though it's not)
But the problem is the link could go bad at any time leaving the question useless
(if his blog were to be taken down)
@SebastianNielsen I would only flag if his blog was behind a paywall, or obnoxiously ad-laden. The blog title is also pretty clear as to the author.
20:39
I think it's very close to link only. It's one of those grey areas that people might fight about on meta. This is with still being new to python though
python (not cython)
@SebastianNielsen I thought your complaint was about non-disclosure. If the link-only nature bothers you, leave a comment.
I don't think a comment would have any effect.
Hello ..
I'm using multiprocessing...in that i have a query..
in process1, i connect a server via websocket which takes input from the user..
in process2, i get the search result and post it back to the user..
so the class in process1 will be shared in process2 or not??

if it not shared, then what should i do.. i can only create only 1 websocket connection
@SebastianNielsen Do you have some history with this poster that leads you to say that? People can surprise you.
@Permian I think they meant CPython, but you're right, not cython
20:45
Cpython yes
@Permian ugh
cpython is the reference implementation
8 hours ago, by Andras Deak
> The current version of Jython is 2.7.1 It can be downloaded here:
Why don't you use prolog instead of python to write provable code?
01:00 - 21:0021:00 - 00:00

« first day (3386 days earlier)      last day (1787 days later) »