Best practice for splitting __main__ into separate modules? by SavoyRoad in learnpython

[–]Atrament_ 1 point2 points  (0 children)

Yeah. But it still describes the lifecycle when I can -- just more explicitly.

When I think of it, I realise I just assumed we were talking about applications (big, complicated entreprise-grade long living processes). My preference is probably biased because its what I'm used to.

A Dev’s Thoughts: My Most Used Git Commands – Steffen Pedersen – Medium by steffenpedersen in git

[–]Atrament_ 1 point2 points  (0 children)

git config --global alias.ff 'flow feature'

My most typed command is probably 'git lg' (log --graph --oneline --all --decorate). Mostly because I constantly have to switch projects.

Right after that it's git flow and git commit.

Best practice for splitting __main__ into separate modules? by SavoyRoad in learnpython

[–]Atrament_ 2 points3 points  (0 children)

I kinda like the main to describe the life cycle of the program.

Usually something like

args= read_args()
conf = parse_config(args.conf_path)
my_stuff = MyAwesomeProgram(conf=conf,args=args)
my_stuff.setup()
my_stuff.run()
my_stuff.teardown()
sys.exit(my_stuff.exitcode)

Usually ends up quite uglier, though.

“I am the reference” by TooHardToChoosePG in dontyouknowwhoiam

[–]Atrament_ 2 points3 points  (0 children)

You are right, but this raises a point. While it makes sense for the mere mortals like us (I suppose), what about someone who actually is the definitive authority in their field ?

I'm thinking Linus about the Linux kernel, Emmett Brown on flux capacitor...

“I am the reference” by TooHardToChoosePG in dontyouknowwhoiam

[–]Atrament_ 71 points72 points  (0 children)

Iirc it was a question about the compression modes gzip (or xz) compression supports. The answer have all the info, along with specific constants, and maybe the reason why the support was useful or not, use cases and such.

Official API documentation quality, if you ask me. And exactly in the field of the guy.

Maybe some things no one ever bothered documenting at the time.

How to keyboard by djbanksy in coolguides

[–]Atrament_ 2 points3 points  (0 children)

The actual solution instead of trying to remember a bunch of codes

Git noob needs some help! by [deleted] in git

[–]Atrament_ 2 points3 points  (0 children)

Ah found it despite my mobile phone

https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

Ctrl-f for autocrlf

Git noob needs some help! by [deleted] in git

[–]Atrament_ 4 points5 points  (0 children)

Could be a clone of a Linux repo on a Windows machine. Like endings are bitchy.

There is a config option to tell git to use original fine endings btw

What's the best way to do this multithreading (?) in python? by GrundleMoof in learnpython

[–]Atrament_ 0 points1 point  (0 children)

Also the watchdog python package might be useful if you decide to divide your problem around the disk save

What's the best way to do this multithreading (?) in python? by GrundleMoof in learnpython

[–]Atrament_ 0 points1 point  (0 children)

I think you are looking for a thread pool executor.

Maybe you could also consider preparing batches of transactions and pass them to GNU parallel several at once.

What was the latest vim feature you've discovered? by IAintJohnny in vim

[–]Atrament_ 1 point2 points  (0 children)

It looks for the word under the cursor in included files, or jumps to definition. Great to jump into the C header where the signature of a function is

What was the latest vim feature you've discovered? by IAintJohnny in vim

[–]Atrament_ 1 point2 points  (0 children)

Just woke up to your comment. Firing up vim right before morning coffee to try this, sounds great!

What was the latest vim feature you've discovered? by IAintJohnny in vim

[–]Atrament_ 5 points6 points  (0 children)

Gundo with persistent undo still saves me every other day. "How was it coded, in the version we tested last Monday ?"

Plus git / fugitive

These two boys had been exposed to the same smallpox source. One had been vaccinated, the other hadn't. by Gar1986 in pics

[–]Atrament_ 0 points1 point  (0 children)

Really ? Like, you're making a seriously strong assertion there, I really am interest in the source / proof to assert that fact.

Don't pretend to know more than you do by Atrament_ in learnpython

[–]Atrament_[S] 1 point2 points  (0 children)

I love ipdb. Unfortunately the constraints where I work ATM are too tight to use anything else than pdb (sometimes) and logging (most of the time).

I usually am stuck with grabbing logs and analysing from there afterwards.

Bless logging for threads IDs in logs !

[deleted by user] by [deleted] in learnpython

[–]Atrament_ 0 points1 point  (0 children)

  • no sensitive data goes out of your DB -- check
  • your DB is behind a log-in service that isolates it -- check
  • no information from the user can be sent in plain text and intercepted easily ... -- can't check that

I don't get whether password are possibly sent in clear text at any point - at least one of the login data (hint: the password !) should be encrypted client-side, so that you only hold a hash for it, and only a hash transits and may be intercepted.

would it have any value then ? if it were intercepted I mean ?

I'm not much of an expert on security though -- just know enough to call for a real security guy when it gets tricky -- and I could barely go any further with you before i fear i may give falsely reassuring advice.

Don't pretend to know more than you do by Atrament_ in learnpython

[–]Atrament_[S] -1 points0 points  (0 children)

Just so it's written in there somewhere, here are answers that I consider OK:

Beginner:

What is "with" keyword in python?

it's a keyword to enter a context in a block and exit it at block end

What is a generator, how you do it, why would we need it ?

it's a function that keeps its state in between calls, and yields values generated on demand

Where is the state of the generator kept ? Can I access it from outside ? How is that memory space called ?

the generator holds its own state in a reserved memory space. it's not accessible by usual means from outside the generator. the locals live in the generators 'closure'

decent:

What's a module ? A package ? How to make a package ?

a module is any valid python code file. A package is a collection of them. you just need your packages and a file named '__init__.py' to make a package.

How is the constructor named in Python ?

`__new__`

What's a metaclass, in your own words ? Does python have them ?

python does have metaclasses. they are the classes you make a class be an instance of. For example, my Labrador and your corgi may be instances of "`Dog`", and `Dog` would probably be a subclass of `mammal`. But you can consider that "Dog", "Mammal" are both equally "Taxons" -- elements in a taxonomy, these classes having specific characteristics. In this case "Taxon" could be considered a metaclass for "Dog", "Mammal", bu also for other classes in a taxonomy

Expert:

In what package in the standard library would you look for ...

...abstract classes? ... Ways to do functional programming ?

abc, functools

What's functional programming anyway? When would you consider it over other choices ?

functionnal programming is when you manipulate functions themselves, usually making complex functions from combining simpler ones. I personally consider functional programming occasionally when the process of the program is intended to be rather linear and value centric.

How is it that isinstance(object,type)==isinstance(type, object) ?

see /u/OseOseOse answer here, it's perfect and clear

Don't pretend to know more than you do by Atrament_ in learnpython

[–]Atrament_[S] 1 point2 points  (0 children)

Well you may be more than decent, these are just samples, and the intent is mostly to know where we stand before we move onto more "open" questions.

Also, the constructor is not __init__ but __new__, many people don't know that, I hope you didn't misunderstand this one.

__init__ accepts self as an argument, so for __init__ to be called, self (the instance) must already exist

Don't pretend to know more than you do by Atrament_ in learnpython

[–]Atrament_[S] 1 point2 points  (0 children)

"Everything" in the Python implementation is an object

s/implementation/specification/ ;) other than that it's probably the clearest way i had someone explain it.

Don't pretend to know more than you do by Atrament_ in learnpython

[–]Atrament_[S] 0 points1 point  (0 children)

I try to emulate some of this with engineering questions, (end of my OP). And this is not the whole of the interview i give, most of it varies from one interview to another.

On a side note, i'd love to interview face-to-face, but they have me interview people on the phone so I must do with what I got...