« first day (3545 days earlier)      last day (1388 days later) » 
00:00 - 15:0015:00 - 00:00

3:00 PM
there is No-OPs which means not operational
 
and CMs are Community Managers, employees facing the community
 
are CM's different than moderators?
 
Yes, CMs are employees and moderators are volunteers.
To make it a bit more confusing, the official name for mods is "community moderators" which would also abbreviate to CM, but we don't do that
Sometimes you can see non-CM employees post to meta, such as Yaakov Ellis who's a dev
 
truly it's perplexed.. Anyways I think best is to leave it and with time and reading posts on meta I might get all those things.
 
probably
Both mods and CMs have diamonds next to their names, but mods are listed at stackoverflow.com/users?tab=moderators and employees have a "staff" badge in their profile
 
3:03 PM
@VisheshMangla No-Op usually means "no operation", which is something other than "not operational".
 
Op so the p is small here
 
I spell that as no-op
note that OP is an acronym, whereas no-op isn't
 
...so much of terminologies
 
there's surprisingly little jargon on SO (Stack Overflow :P) compared to how much programmers like technicalities
 
only industry people know those jargons
it's difficult to understand them for coders who are not programmers
 
3:08 PM
That might in fact be the reason they exist
 
Fortunately the terms are either generally accepted so they're easy to google, or they're local in which case you can just ask the locals
 
Every in-group has their shibboleths
 
/me mutters something about cabbage...
 
3:36 PM
I need a mnemonic to remember the argument order of json.dump. I always get it wrong on my first try, even when I account for the fact that my first guess is always wrong.
 
spin-half arguments
 
object appears first in json?
javascript object notation blah blah blah... not great...
 
just remember D.U.M.P.:
- Dump should be called with
- Unicode string or other serializable object
- coMma
- Pointer to file
 
The order is the same as in the english language: It dumps what where
 
why not just remember the arguments obj= fp= ?
 
3:43 PM
@Kevin use kwargs?
 
that's as much effort as looking at the docs
 
@MisterMiyagi I'm open to the idea... But then I'll need a mnemonic to remember the names of the kwargs
 
dump object into file
 
"Was it fp, or file? Was it object, or obj"?
@VisheshMangla You might as well ask that about any piece of information that people use mnemonics to remember
"Why not simply remember the order of the planets without coming up with a fun rhyme?"
 
@Kevin It's the standard library. The obscure, non-PEP8 name is always the correct choice.
Notwithstanding an enumerable amount of exceptions.
 
3:47 PM
well mnemonics never worked for me. Teachers told about them to learn trigonometry and I found it better to remember just like that
 
He's not asking for a mnemonic for you, he's asking for a mnemonic for himself :P
 
I think dump object into file would be better to remember because dump file into obj doesnt make sense
 
@MisterMiyagi object would shadow a built-in... and file would have done that in legacy
 
I'm 55% sure that "dump into file the object" is technically syntactically correct English
 
@VisheshMangla dump into file from object
 
3:50 PM
culture difference, I usually speak that so I though it, sorry I should have thought more from a broader perspective
 
@MisterMiyagi objekt=...
 
@AndrasDeak There is someone, somewhere, out there, writing a function with that signature, right now...
 
do you remember the args of json.dumps?
see both of them take obj as first arg
 
@VisheshMangla but in case of dumps there's no other positional arg to speak of
 
I mean, there's nothing inherently wrong with saying "I simply remember the order of the arguments, I don't find it difficult". The problem at hand is highly subjective so there's no one "right" way to do it
 
3:54 PM
@Kevin Just invent a catchy story about Jason Dumpof, international super spy.
 
"dump and dumps have the same first parameter" is promising... Let's see if I remember that a month from now
 
dump puts obj in a file and you need with .. as f:
you need to put that f somewhere so thats the second arg
whereas .dumps returns a json string
 
It's not quite a mnemonic since it doesn't associate a known piece of information to an unknown piece of information without introducing any new unknown information, but it's... more compressed, in a sense
 
so you just need to storre it in a variable
I find correlations better than mnemonics
 
International superspy Jason Dumpof completes his (object)ive, then his supervisor evaluates his performance by putting (pointers) in his (file)
It occurs to me that I've been assuming that fp stands for "file pointer" but it doesn't explicitly say that in the docs
The Python ecosystem is usually quite reluctant to mention pointers in any context so maybe I'm jumping to conclusions
 
4:02 PM
the p is silent
 
Maybe it's permissible here because it's an acronym that is never explained
 
perhaps they meant "file descriptor", and used the bottom-up d because it looks cute.
 
Querent: Wise master, what is the meaning of `obj` here?
Wise master: it means "object".
Querent: and `fp`?
Wise master: "file".
Querent: But "file" does not have a "p".
Wise master: ... The lesson is over for today.
4
 
@Kevin It's a hang-over from C: "File Position Pointer" (why fp became more popular than fpp I have no idea - except maybe lazy programmers)
 
I think of it as "file pointer"...thus fp.
 
4:11 PM
Sounds sensible. My hazy memories of C++ told me that fp is an idiomatic name for a file object pointer, but I didn't want to generalize that to Python
 
@LinkBerest because fpp is the fortran preprocessor
 
@AndrasDeak not sure - that would make sense with BASIC and the like but C shrug (good a theory as any though)
 
TIL: A Protocol can be parameterised by a callable to become a callable of the same signature. My mind is still in the process of blowing up...
 
@Kevin yeah, in C fp is commonly used as the "pointer" to the "structure FILE" (from stdio.h) which is known as the "file position pointer" so C++ would follow that convention
Though, the first time I was explained fp it was "look at stdio.h the FILE struct's first line is unsigned char *_p for the position so "file position" just fills in the "_" with an f
 
Trying to see where fp came from... History diving reveals that Python's json module was originally third party library simplejson, and integrated with (AFAICT) no changes to any parameter names. simplejson has used fp as the parameter name since its first github commit 15 years ago
 
4:18 PM
@Kevin I don't know whether I'm ashamed to say "dump trash in the bin" (which potentially suggests my JSON is trash, but it reminds me which is the recepitcal and what I'm trying to put in it :P
 
@Kevin that commit predates github by 2 years, actually
 
@AndrasDeak witchcraft
 
The person who told me that then explained the "file position pointer" as how the "F" also came from ALGO (60) which he started with and it was FILE F(...I forget) - meaning they started with F then added _p so "fp" - so there's also that
 
Well, at least that backdating suggests that the full history of the project is visible here, and isn't just the slice of history that coincided with github's existence. In other words, I don't need to go digging through circa '05 sourceforge repos to find earlier commits
 
yup
 
4:22 PM
I don't know if that was cannon or just a really old programmer giving their opinion mind you - still always thought it was neat though
 
Any industry worth its salt has unconfirmable folklore :-)
 
and ghosts in their machines
 
The smoking gun I was hoping to find was "simplejson started out as a straightforward port of a json library for C, where fp is a perfectly cromulent parameter name". Alas, I don't see any confessions of that nature
 
I was looking up Niklaus Wirth to see how FILE developed from ALGOL to Pascal but don't see any particular mention of "fp" - mores the pity
 
4:39 PM
bob.ippoli.to/archives/2005/12/26/simple_json-10 indicates that simplejson's "official API follows the familiar convention of marshal and pickle". So it's their fault that the parameter is named fp.
... Or so it would seem, but both pickle and marshal's dumps use file, not fp.
As of 2.7 and later, at least. Maybe I should look up what their '05 versions used.
 
hmm...my comment stating exact figures (literally I just hand counted a few posts) was deleted from an employee's post - are we not even allowed to state facts anymore?
 
@LinkBerest post an answer
 
I already did that - this was a small point not worth an answer but worth a note (yes, yes - I know discussion is dead on Meta complaining doesn't help - but still.... :P ;) )
 
the powers that be disagreed :P
 
Odd, raw.githubusercontent.com/python/cpython/master/Misc/HISTORY jumps from Python 2.5 release candidate 1 to Python 3.0a1. Where are 2.6 and 2.7?
In any case, I got my answer: '05 corresponds to Python 2.4. Now to track down contemporary documentation...
 
Thanks :-)
 
hmm...it seems a common convention in Pascal was to use "p" to denote a pointer to a type (such that fp := f^; is seen in the language) but I don't see anything definitive
also this gives weight to p = pointer not position but its all muddy at this point
 
dump( obj, file[, protocol[, bin]]). So much for following the familiar convention of marshal and pickle ಠ_ಠ
 
json just doesn't like you @Kevin
 
what is hash function in python ? any ideaa i have a categorical variable i wanna apply on that ?
 
4:54 PM
don't worry though - it hates me too (if it didn't it would dress properly once in a while instead of being a mess of missing braces and brackets)
 
Oh well. I'll remember to put in a petition to change json.dumps to (obj, file) in Python 4000, when we have another compatibility schism
 
switch the order while you're at it, will you?
 
Not to be confused with Python 4. The one I'm referring to is 3,996.2 versions from now.
@AndrasDeak In the interests of fairness, all odd-numbered Pythons will use (obj, file), and all even-numbered Pythons get (file, obj)
 
huh...I forgot how much I enjoy researching simple things like how conventions came to be (kinda relaxing to just look through code bases and creators writings rather then my usual research)
....might be simply because I'm not worried about writing a 5+ page explanation of my findings with analysis though
 
@NabiShaikh If you're asking "what is a hash function?", it's a function that takes an object and deterministically returns a number related to that object's data. A good hash function is hard to reverse-engineer and rarely returns the same number for different objects.
If you're asking "where is the hashing algorithm implemented for Python objects, specifically?", I'm looking for it now.
 
5:00 PM
@NabiShaikh what is the X in your XY problem?
 
My expectation is that it varies from type to type, but is usually stored in the type's tp_hash slot.
 
Where did you hear about hashes and why do you want to apply it to categoricals? And what kind of categoricals are we talking about, specifically?
 
so i will set the context first , i am going through a catBoost notebook in kaggle ..over there that guy has applied hash function to categorical variables with high cardinality ....for col in high_card:
enc_nom = (train.groupby(col).size()) / len(train)
train[f'{col}'] = train[col].apply(lambda x: hash(str(x)) % 5000)
test[f'{col}'] = test[col].apply(lambda x: hash(str(x)) % 5000)
i am unable to understand what this 5000 is about and hash function is about
 
ugh, f'{col}' is a terrible anti-pattern
 
@AndrasDeak any alternative to this
 
5:03 PM
136
A: What does hash do in python?

Lennart RegebroA hash is an fixed sized integer that identifies a particular value. Each value needs to have its own hash, so for the same value you will get the same hash even if it's not the same object. >>> hash("Look at me!") 4343814758193556824 >>> f = "Look at me!" >>> hash(f) 4343814758193556824 Hash ...

 
I speculate that % 5000 exists to reduce the amount of space required to store the hash value, at the expense of increasing the possibility of collisions by a large factor
 
@NabiShaikh either col or str(col), depending on whether it's a string or not (former for a string, latter for anything else)
 
Why he's storing hashes in the first place, I don't know
 
I'm thinking its to limit the size and slightly randomize the training set but that's just weird code
 
that looks like a way to generate randomish numbers in [0, 4999] (in a way that maps from categorical to value)
 
5:05 PM
@NabiShaikh note that hash(str(...)) is by default subject to a random salt. That means your categories may be random.
 
@Kevin he is basically converting categorical variable to hashed numbers ..for example RED/GREEN/BLUE is converted to hash using above function ...why i am clueless
 
Am I crazy or is there no PyTypeObject declaration for the base object type
 
@Kevin Do you mean PyObject?
 
... I don't know.
 
From my attempts to bootstrap a custom type+object hierarchy, I can conclude with 50% certainty that object is 50% hackery, aka magic.
 
5:08 PM
Extremely same
 
I would not be surprised to find that CPython opens a portal to hell for every object that needs conjuring.
Pointer sacrifices may be involved.
 
To rewind up the XY problem stack, I'm looking for the code that executes when you do hash(object())
 
hash(object()) is based on id(object()).
 
Github is giving me many 404s right now so perhaps my hunt must wait
@MisterMiyagi Sensible, as there isn't much else that it could be based on.
 
@Kevin That's the Oompa Loompas trying to hide black magic.
 
5:13 PM
Normally an oompa loompa will make no effort to prevent somebody from gazing into the abyss that is the object hierarchy base. They'd rather let them fall in and then sing a song about the hubris of man. Maybe they've changed since all those OSHA lawsuits.
 
5:43 PM
github.com/python/cpython/blob/master/Python/pyhash.c#L132 Appears to be responsible for turning pointers into hash values. It is (indirectly) referred to at github.com/python/cpython/blob/master/Objects/…, which I think puts it in the MRO of any object that doesn't override __hash__. But I feel like that's not the whole picture, because there's no salt.
... Or are salts reserved for objects that don't use object.__hash__, for example int and str? I guess there's not too much use in salting base object hashes, since object addresses are already hard to predict
 
hammered
 
Thanks :)
 
6:00 PM
Ah, hashes are only salted for str and bytes. Ok then.
I'm satisfied. To answer the question I imagined that Nabi was asking, the hash algorithms for most built-in types can be found in pyhash.c. Complexity varies between "two lines of arithmetic" to "sanity-destroying (Iä! Iä!)"
 
Hi, can someone help me with class views success_url in django? I mean sucess_url="/success/" the docs don't tell what is success view?
stuck from too much time on this
 
@VisheshMangla please read the room rules
Just ask your question, and if anyone can help you they will.
 
Bonus quatloos will be awarded to anyone that can write a Python implementation of object.__hash__. I tried doing y = id(obj); return (y >> 4) | (y << (8 * SIZEOF_VOID_P - 4)) but it didn't match hash(obj) for any sensible value of SIZEOF_VOID_P. Or even for nonsensical values.
 
oops that's my default style of asking a question on IRC
I need to change it
 
I also tried doing fake casting between unsigned and signed ints by doing round trips of struct.pack and struct.unpack, but no luck
 
6:09 PM
I need help in getting that missing gap filled
 
@VisheshMangla it's the url of where you want to go after the form has been successfully validated... I'm not quite sure what you're asking?
 
@Kevin whelp, there goes my suggestion
 
jjj
hi all what's a good practice with modifying class instances. Particularly: I'm refactoring some old code and it has a loop where it adds many things to a "container" (some kind of a dict). I wanted to make a new function out of this but since this is going to be called from another function I am not sure how should I handle the instance passing. Should I copy the instance modify it and return?
 
Hmm, maybe I 'm not able to get the docs right and understand class views
 
@Vishesh so if after the form is submitted successfully, you wanted to go to the homepage, you'd set it to '/' for instance...
 
6:12 PM
@jjj any reason you can't just make a private method (function) for this or a generator if all it does it calculate somthing then return the results of that calcuation
 
Well, in my case the user uploads a file through the NSDL.as_view which is at "/nsdl/"
 
jjj
@LinkBerest I can't modify the class definition. Or do you mean something else? Adding a method would be nice but I think I need to deal with this like that. That's why I'm asking about passing the instance around
 
then the file is processed by that run module and a dictionary is returned. Now I want to redirect to a success page which shows that data.
 
then you have a view that displays that data and then set the success_url to that view...
does mean you need to store that dictionary somewhere though
 
@jjj nope, but by your reply: is this a pickled or shelved or otherwise persistent Python object?
 
6:16 PM
are you literally just dealing with a dictionary? You're not persisting it to a table or anything?
 
I need to pass that stats object to the success page
yes its a dictionary
 
So you're not having to show previous runs of whatever?
 
jjj
@LinkBerest No it's not. It's an instance of a class. The class is defined in some external module. Hmm so maybe adding a new method to this instance is an option. Is this what you are suggesting? Something like this: stackoverflow.com/questions/972/… ?
 
basically the nsdl.html has a file upload form, the user has uploaded his file , all now what is to be done is process the file, say count the number of rows in that file and run module will send back {rows:45} like thing. Now sucess page will show this data
 
yes... I get that... but what I'm asking is - do you need to persist the results long term at all... or is it literally they can only ever view results for the very last successful thing they uploaded?
 
6:21 PM
@jjj No, based on your original description without any example code - I'm suggesting you use normal inheritance and build a sub-class. Monkey-patching usually ends up a bad idea in my experience
 
Sorry I couldnt get that well but to what I understood, yes its a one time display
 
jjj
@LinkBerest I see! Thanks this makes sense
 
I mean from a SOLID (OOP) perspective this is what interfaces and abstracts were made for
 
@Vishesh okay... in your form_valid method - make a dictionary with the required data and add it to the user's session... then you have another view that the success_url goes to that retrieves that dictionary back from the session and does whatever with it...
 
its already there that stats is a dict
 
6:26 PM
so look at the next bit I mentioned about storing it in the session
 
what's this session thing?
 
I heard about session last working with requests and selenium
MIDDLEWARRE oohhh
 
jjj
@LinkBerest oops, I have to go but thanks for your help I'll give the link a look in a while
 
Thanks @Jon, I hadn't tried middlewares yet. I can proceed now
hey but otherwise if I make stats a global variable I can do it easily. It just strike me
 
6:29 PM
Okay... don't overthink it though... you should only just need to add self.request.session['stats']' = stats to your form_valid... and then whatever view you create to display the data... access it from there and you'll get your dict back
 
@VisheshMangla Oh my, let's not go there :P
 
no... don't even think about globals... that way madness lies...
 
lol
that was going for a cheap hack for saving time
 
It would end up being pretty expensive pretty quick
 
a.k.a. premeditated footgun use
 
6:31 PM
I always wonder why a lot of beginning Python programmers turn to monkey patching and metaclasses over more standard inheritance so often. I used to think it was a "starting with Python to learn OOP" issue but I see it in people coming from Java and C++ too (less but enough)
 
except it's not going to save time at all - you've got literally one line to write in your existing FormView and then retrieve it from another view you'd have to write anyway :)
 
@LinkBerest something tells me metaclasses are some hype thing. They try regex, can't apply it, so they go with metaclasses.
 
ok I try and then respond back
 
@AndrasDeak I wish I could say I haven't seen that happen before
 
@LinkBerest Erp, I've very, very rarely seen beginners use metaclasses. What tasks they attempt?
 
6:37 PM
@VisheshMangla have a look at dpaste.com/2J7X0EV for a starting point
 
@MisterMiyagi Not use (not in a true use sense) more in the: "I copied and pasted this from somewhere (probably SO)" sense or their asking about a concept and getting confused what a meta class is (and how used)
I have seen a lot of monkey patching though (in production code too with a co-worker who got reviews like this regularly when using Python but was a solid C++ programmer)
 
Thanks for the help again @Jon.
 
Monkeys deserve variety though @LinkBerest... can't always expect them to hang out in large groups and hope they reproduce the works of Shakespeare...
 
@LinkBerest Oh my, I pity the poor souls that cargo-cult metaclasses.
 
that hit two birds with a single stone. I got to learn about TemplateView usage now too
 
6:44 PM
@MisterMiyagi As to the regex to metaclass example that Andras stated - I know where that came from. I used to have a snake to camel case (and vice-versa) assignment for teaching regex: turns out there's a very good IBM metaclass tutorial which does that as its example of metaclasses
Note, I really like that tutorial for advance Python courses but for beginners its a minefield
 
@LinkBerest I only mentioned another piece of programming that eager newbies are likely to abuse. I had no idea this metaclass thing also involved regex
 
oh, I didn't mean that you were implying that exact instance - just that I've happened to see that exact instance when students copied and pasted code from that....and then got lost in the madness :)
 
metaclasses and regex at the same time... "My oh my said Alice!" :p
 
but yeah, I teach regex with Java now (Python is the advance data manipulation part so they have a basic understanding of regex at that point) and it has its own pit-falls :P ;)
 
@Jon there's a good site for django which has good stuff about Views and so on and also tell what functions are in there in a View, Model etc. I lost it from my bookmark when I formatted my pc. Can you provide a link to that?
 
6:51 PM
My crystal ball says you might be after: ccbv.co.uk ?
 
@JonClements good thing you charged it
 
@LinkBerest That reminds that I did want to play around with an OOP-based regex syntax...
 
yes that is it. Btw how do you search on this site. I couldn't find a search bar here yet.
 
you mean the one right at the top middle of all the main site pages with a magnifying glass and "Search" in the box? :p
 
@JonClements oh.....wait, no! Nope, I cannot do that. I don't want new programmers heads to explode :P ;)
 
6:53 PM
still stuck on finding a punny name, though...
 
Err... no thanks...?
 
unable to find in here
 
@MisterMiyagi You mean performing a regex in an OOP language (C++/Java) or building a parser for regex like an ORM? (the second sounds interesting actually)
 
@VisheshMangla oh thought you meant SO - that ccbv site doesn't have a search...
 
oops I think I misunderstood you. Yes I mean like django docs has one
oh ok. Thanks still that site is more useful than the docs at times when you need more specific info.
 
6:57 PM
@LinkBerest Building the regular expression itself using objects and methods. E.g. digits[3:5] instead of r'\d{3, 5}'.
 
@VisheshMangla just fallback on the old site:ccbv.co.uk search terms in google and see if that helps
 
yeah, I've worked on those type of parsers (mappers?) before (just to play around with it). Actually it was part of when I was trying to learn classes in Python (in depth) and regex - coming from Perl I had a pretty good regex knowledge but Python's syntax was a bit jarring
 
yeah docs contain TemplateView but not what is inside it. One can go to github and see the code but that is not so easy to grasp everytime
 
@Vishesh they do - but they're got more fluff around stuff...
 
I think having a separate page for individual views can be better
 
7:12 PM
Umm... does anyone who actually uses linkedin more than me (which basically makes using it all I think :p) know if there's a way when you're looking at a profile and it says they're a 2nd connection to you (which apparently means they're connected directly to someone you're connected with) to see who that mutual party is?
 
@VisheshMangla huh? do you mean in the documentation or in regards to the actual design pattern Django follows? (which is Model View Controller - technically more Model Template View - as opposed to MVP or MVVM)
 
nope , I mean separate doc page for each of TemplateView, FormView and so on.
I don't know about the MVC architecture much but django handles it wonderfully
I tried node.js and there I had to do everything from scratch + nasty javascript. Django does all things for you
 
@JonClements you can do it with search (I honestly forget how - its in People search you can select 1-3 for connections) or click on their profile and the "Mutual Connections" should link to that search)
 
Ahh... so it being doable is good... I wasn't even sure it was and was going to waste time trying the impossible
 
7:19 PM
yeah......wow using that I did not realize how bad all this had hit the last two places I worked until seeing everyone of my old co-workers are without a job :\
 
okay... so searching for some I can see they're a 2nd connection and shared connections, but for his specific profile, I can't...
must be privacy settings or something I guess?
 
If its using the above search then yes: I would assume there is a privacy setting
 
Yup... mind you - leaving the text blank and just selecting 2nd... bloomin' heck... some names coming up I haven't thought about in years... feeling a bit nostalgic now :)
 
dpaste.com/1D2TG4Z is model.objects.exists() wrong to check if model/table is empty in django?
 
@JonClements yeah, I left my last job (for academia) because I was sick of playing politics and it seems like I was just the start of the exodus (which makes me feel both better and a bit sadder about that decision)
 
7:27 PM
@VisheshMangla the exception would indicate - yes it is :)
It's not quite clear what you're actually trying to do as you don't show all the relevant code...
 
reddit.com/r/django/comments/c8nl3s/… though jumbled but that is talked about here
MyModel.objects.exists() will stop querying at the first object
this is the code. It is good if it can help
that means if database table is empty clean it and populate it with data)
 
anyway, since I'm "off" today - meaning I'm working on course and book stuff at home - its time to make a special dinner for the fam (entrecôte con papas fritas y Judion -> ribeye with fried potatos & Judion beans). rbrb all
 
Umm... you're certainly doing some non-standard (kind of weird stuff) there @Vishesh... you're going to have to debug that yourself
 
I know it seems idiotic to send stats of how many rows failed to get inserted into the db , how many got inserted etc but that's what I have been told to do.
I know it is counter intuitive that y one would want to know all that stuff. You can think of this as reimplementing some king of logging.
Well the problem is something else. I think I forgot to share one important piece of code dpaste.com/2QC6R0B. django-postgres-extra.readthedocs.io/en/latest/manager
I m using the Provide psqlextra.manager.PostgresManager as a custom manager:
I think it's overriding my objects default manager
I neither know anything about the internals of context managers in django
it was but that means tons of errors waiting ahead for me
 
8:05 PM
I know this isn't Cooking.se, but anyone have any simple homemade recipes involving shrimp that you recommend? I'm thinking of pasta but I'm open to anything.
 
8:22 PM
@cs95 fry shrimps, serve with stewed zucchini+chickpeas+soy sauce+peanut butter
 
8:35 PM
D:
 
@AndrasDeak Which of those? :P
 
yes
 
You can optionally replace every ingredient with Sauerkraut, as desired.
 
decisions, decisions...
 
umm.... shrimp risotto...
 
8:51 PM
hi
 
hello
 
So... this is chats
I never interacted with someone before
I got a question, should we still use lambda?
 
@theX you already had 4 messages here, e.g. chat.stackoverflow.com/transcript/6?m=49708918#49708918
 
yep
I know
But no one really responded
anyways...
In python3, should we still use lambda?
 
yes, sparingly, as always
 
9:06 PM
@Aran-Fey Rarely?
 
yeah. Only as arguments to sort(key=...) or min(key=...) or the like, pretty much
 
Oh, so it's not prefered
 
DRP
9:36 PM
Hi team! I checked the chatroom rules, and believe this question is relevant to python. I have done research be reading/following the doc and also here on SO. Usually if the links don't give me the fix at least they contribute to chase the issue other ways, but right now the 'error' is not giving me any further insight after having following steps from sources mentioned above.

So the issue is: NameError: name 'create_engine' is not defined
Im running Centos machine.

As per docs i proceeded with:
 
You need to import create_engine from somewhere, presumably from sqlalchemy
 
@DRP You're missing the import... see (docs.sqlalchemy.org/en/13/core/engines.html) - eg: from sqlalchemy import create_engine
 
This paper is packed to the brim with proposition about resource allocation between nodes during the water simulation. Wouldnt worry about that. With the computing power of todays computers
 
DRP
@JonClements thanks for checking, but shouldnt it be importing everything? my understanding is that it is that same as doing # from sqlalchemy import create_engine
 
Churn em and Burn em
 
9:41 PM
import x imports the module but doesn't make its contents available in your local namespace. That's what from x import * does
from x import y -> y vs import x -> x.y
 
DRP
gosh looks like I have some basics to master first....
so yeah error is different now....
no wonder the freaking example has an import for every statement
again my thought was a ** import whatever** , now I got everything to go.... apologies, and thank you @JonClements and @Aran-Fey for your prompt response. CHeers!
 
@DRP tangentially related: how do names work in python?. It focuses on something different (but equally important so worth your time anyway). But it might also convey the message that there's no magic when it comes to names in python. Something has to define a name before you can use it.
 
Please help with this classmethod error dpaste.com/3FQWKR9
stackoverflow.com/questions/37457207/… I read this and addedthe word metaclass= but it did nothing
 
9:57 PM
that sounds a lot like something we discussed here a few hours ago...
 
yes I remember you said have you ran it?
and I said cleaning up is remaining
well I 'm in that situation that you had already forcasted
 
I meant something else
 
3 hours ago, by LinkBerest
I always wonder why a lot of beginning Python programmers turn to monkey patching and metaclasses over more standard inheritance so often. I used to think it was a "starting with Python to learn OOP" issue but I see it in people coming from Java and C++ too (less but enough)
metaclasses are a highly advanced programming pattern so they are rarely the solution to random programming problems
 
But here I require them
let me show full code
 
10:06 PM
Why do you need to use metaclasses in that?
 
because all methods are same except for the update_or_create
for Demtad and Demathol
so Generalmodel is an interface
 
But isn't that what the Django ModelBase offers?
 
well I didnt know about them, let me see the docs, guess I was reinventing the wheel
 
I've barely ever used Django but I'm pretty sure you are
 
not that much
started 2 months ago
majorly whatever I have made till now involved more of python and very less of django
but this work is different
thanks @roganjosh that might save me from errors it but I ll leave that reading for tomorrow
 
10:23 PM
@VisheshMangla That's fine. It's possible I'm wrong because I don't really see where Django comes into what you've written there but you showed similar code earlier in the middle of a discussion about django, including the realisation of middleware, sessions and suggesting you use a global dict. I've struggled to follow what you're doing but it definitely feels like you would benefit from reading around django before proceeding
 
11:06 PM
@MisterMiyagi soy sauce and peanut would go well fried with some butter garlic, mmm
 
00:00 - 15:0015:00 - 00:00

« first day (3545 days earlier)      last day (1388 days later) »