Yeah the scientific view array-like object viewer is pretty great.
|
|
# ? Jul 1, 2018 19:40 |
|
|
# ? May 15, 2024 04:07 |
|
cinci zoo sniper posted:Yeah the scientific view array-like object viewer is pretty great. This works for Pandas just as well in the free version with no scientific mode, too.
|
# ? Jul 1, 2018 20:40 |
pubic void nullo posted:This works for Pandas just as well in the free version with no scientific mode, too. Oh, looks like that just got extended around the advent of scientific mode, or I otherwise missed it. Either way, my main thing (the only, pretty much) with scientific mode is code cells. It's all I need from Jupyter without the bloat accompanying the latter.
|
|
# ? Jul 1, 2018 21:13 |
|
Pycharm's also an outstanding IDE for web languages (JS/TS/HTML/CSS etc), and with the official plugin, Rust.
|
# ? Jul 1, 2018 23:11 |
|
Is there a way to bulk import a whole subdirectory? I ask because I've got 150ish files in books/, import them all manually and then call them for example using that.Python code:
Sad Panda fucked around with this message at 00:08 on Jul 2, 2018 |
# ? Jul 2, 2018 00:02 |
|
Dominoes posted:Pycharm's also an outstanding IDE for web languages (JS/TS/HTML/CSS etc), and with the official plugin, Rust. Really? I assumed that wouldn't be the case as Jet Brains has a separate JS IDE.
|
# ? Jul 2, 2018 00:08 |
|
I wouldn't use it preferentially over the JS IDE if I was doing pure JS but if you're doing a full stack project with Python you can do the frontend stuff in Pycharm and it's actually really seamless and nice.
|
# ? Jul 2, 2018 00:16 |
|
Wallet posted:Really? I assumed that wouldn't be the case as Jet Brains has a separate JS IDE. PyCharm is basically a superset of WebStorm. Generally speaking, WebStorm gets ahead of PyCharm when they do a release, but then the next of PyCharm catches it up.
|
# ? Jul 2, 2018 01:40 |
|
Sad Panda posted:Is there a way to bulk import a whole subdirectory? I ask because I've got 150ish files in books/, import them all manually and then call them for example using that. Maybe I'm missing something but you could just use the os package and get all the files in a directory and then iterate over them.
|
# ? Jul 2, 2018 03:56 |
huhu posted:Maybe I'm missing something but you could just use the os package and get all the files in a directory and then iterate over them. Use glob for this.
|
|
# ? Jul 2, 2018 05:00 |
|
Specifically, pathlib.Path.glob.
|
# ? Jul 2, 2018 05:20 |
|
Thanks for the start.Python code:
books/filename.py to books.filename My initial reaction is to convert to a string and manipulate it, but there's probably a smarter way when I read the docs.
|
# ? Jul 2, 2018 09:09 |
Sad Panda posted:Thanks for the start. Just use regular glob, https://docs.python.org/3/library/glob.html
|
|
# ? Jul 2, 2018 09:15 |
|
This might seem like a crazy-person thing to do, but is it possible to pass an operator by reference. Im trying to figure a way to create am array of rules that can be used to analyse a musical interval or group of them, so I can go;- "if note a and be is a rule 1 or a rule 2 but not a rule 3 and is a rule 4 then constraint satisfied" each rule has a class with a check_constraint(*notes) ie IsSemiTone, IsWholeTone, IsNotAugForth etc and I want to be able to pass in a list of these and and,or,not,xor etc the idea being is the end user can chose the constraints and then I permutate over a scale and check validity I'm looking to try and work out the minimum rule sets to generate various types of tonalities. Ie western harmony, chinese scales etc. Turns brute searching all possible scales isnt expensive. (2 ^ 12)/2 (can cut the search space in half as all scales start on the first note, so position 1 is never 0 ) poo poo, maybe i should just use eval (also I know you can generate a scale just uaing circle of fifths, but im trying to avoid symetry group type constraints) duck monster fucked around with this message at 19:35 on Jul 2, 2018 |
# ? Jul 2, 2018 19:33 |
|
All operators are magic methods, no? Like < is __lt__? Reference those instead perhaps. There's also the operator library: https://docs.python.org/3.4/library/operator.html edit: not sure if you can do this for and/or.
|
# ? Jul 2, 2018 19:39 |
|
What exactly would you want users to pass to your function? A multidimensional list of strings that evaluate to functions or Boolean operators?
|
# ? Jul 2, 2018 20:16 |
|
Master_Odin posted:What exactly would you want users to pass to your function? A multidimensional list of strings that evaluate to functions or Boolean operators? Functions and booleans, but the __operator__ seems the way to go
|
# ? Jul 2, 2018 21:22 |
|
Sad Panda posted:Is there a way to bulk import a whole subdirectory? I ask because I've got 150ish files in books/, import them all manually and then call them for example using that. You can create a package of modules as "books" if you create a __init__.py file there. It can import different ways depending on how you do it, one of which is to do all of the import statements in the init file (which will give you the books.file.function that it sounds like you want)
|
# ? Jul 3, 2018 00:15 |
|
duck monster posted:Functions and booleans, but the __operator__ seems the way to go You can though use the operator module (or __operator__ magic functions on the classes) and then do what sqlalchemy does and define and_, or_, etc to then combine the functions you're calling into a meaningful way, or decompose it into a minimum set of operations if that's your aim.
|
# ? Jul 3, 2018 02:53 |
|
Speaking of glob and pathlib: if you wanted to do a case-insensitive comparison on a non-Windows system would you instantiate a PureWindowsPath so you can do Path.match("*.py") or use string compare e.g. Path.name().lower().endswith("*.py")? I think string compare is uglier to read; is using a Windows Path too much of a hack in this context? Does it even matter? (I tend to self-bikeshed a lot).
mr_package fucked around with this message at 21:21 on Jul 3, 2018 |
# ? Jul 3, 2018 21:16 |
|
I don't think using PureWindowsPath would help here, but I could be wrong. If all you need is the extension to ignore case use glob syntax: *.[pP][yY]. edit: On using PureWindowsPath, the implementation of #match is from the superclass PurePath. Each of the "flavors" has a case-folding method applied to the input, and on Windows it simply "to-lowers" the input. Using that on a Linux system would cause even more issues with case sensitivity! necrotic fucked around with this message at 21:28 on Jul 3, 2018 |
# ? Jul 3, 2018 21:23 |
|
Ah ok thanks-- I just did a quick test on macOS and it was working, but it does seem regex is the obvious choice here. I just want to avoid the case where someone names a file .ZIP or whatever and then everything breaks.
|
# ? Jul 3, 2018 21:52 |
|
MacOS is not Linux and is not case sensitive by default.
|
# ? Jul 3, 2018 21:54 |
|
I have a pet project that I’ve been hashing out for a while now, and I’ve decided I want to use Flask as my backend. I don’t know anything about Python, but I do know that flask comes with a built in local server and database. I was recommended in the past to use Postgres as my database, but as of right now I only have experience with MySQL. My question is that I’m wondering if there’s any advantages in using postgres with Flask opposed to MySQL. (FWIW, I only think I’ll need to GET endpoints, so a framework is probably overkill, but this isn’t a serious project).
|
# ? Jul 4, 2018 02:15 |
|
Grump posted:I have a pet project that I’ve been hashing out for a while now, and I’ve decided I want to use Flask as my backend. Flask doesn't know anything about databases, you could write everything to a plain text file it wouldn't know or care. It's like asking if your python script cares if you're using a 144hz monitor. If you want something that gives you help with databases, you'll need to use Django or use an additional library with Flask. If you're using an ORM, then, from the standpoint of your ORM and your application it doesn't matter which database you're using...postgres or MySQL will both suffice. If you're not using an ORM, then with Django or Flask you just import the correct mysql or postgres library and write your SQL. Neither cares which DB you're using. Postgres is recommended over MySQL for reasons that mostly don't have anything to do with how you write or use your application and that's even more the case if you're using an ORM. It is recommended because of all its features beyond basic SQL, like built-in NoSQL support, full ACID compliance, and things beyond features like it being open source without Oracles involvement. Usually when Flask comes up, I feel compelled to point out that Flask is a great and capable framework, but the reason many people choose it over Django is that it's "lighter weight". This is wrong, Django is capable of being used in the same light weight manner. There are good reasons to use Flask, but if this is your reason you will want to reconsider.
|
# ? Jul 4, 2018 02:56 |
|
And an ORM is just a tool that abstracts away the SQL into more functional programming paradigms?
|
# ? Jul 4, 2018 03:16 |
|
Basically. Django has one in the box, you use different ORM libraries with Flask.
|
# ? Jul 4, 2018 03:17 |
|
At work in am receiving a backup of an Sql database, but I will not be getting control of any of the existing infrastructure or front end. I was thinking about throwing up a quick and dirty Django front end, but have no idea how to set up the orm to handle an existing database. Is there an accepted best practice? Should I just build out a new table structure that I can import the data into, or is there a better way?
|
# ? Jul 4, 2018 04:17 |
|
necrotic posted:MacOS is not Linux and is not case sensitive by default. code:
mr_package fucked around with this message at 07:07 on Jul 4, 2018 |
# ? Jul 4, 2018 04:25 |
|
Master_Odin posted:That still doesn't really tell me much on what exactly your data structures are or how you're looking to combine them. I ended up taking a really simplistic way of doing it. OPERATOR_OR = 0 OPERATOR_AND = 1 code:
Heres an example of one of my rules;- code:
code:
But ultimately, it correctly identifies that the only scale where every note is a whole or halftone and there are no consecutive semitones, are the whole tone scale , wholetone-halftone scale , major scale and melodic minor scales, and of course their modes. And if we chose to ignore Harmonic minor, I *think* those scales encompass pretty much everything in traditional western tonality in just 3 simple rules. Now to find a minimal set of rules that can include the Harmonic minor scales and a few of the less common scales of pre "everyone started writing crazy poo poo" era western canon up till the romantic era.. duck monster fucked around with this message at 21:26 on Jul 4, 2018 |
# ? Jul 4, 2018 07:57 |
The Fool posted:At work in am receiving a backup of an Sql database, but I will not be getting control of any of the existing infrastructure or front end. Modeling an existing table schema in Django's ORM isn't too much of a hassle. Just specify db_table and db_column if you don't want to rename anything. There shouldn't be anything in the schema it can't deal with, or if you do it might not be important anyway?
|
|
# ? Jul 4, 2018 10:50 |
|
The Fool posted:At work in am receiving a backup of an Sql database, but I will not be getting control of any of the existing infrastructure or front end. You want Django introspection. It will build out the models based on the existing table structure.
|
# ? Jul 4, 2018 13:58 |
|
I'm on mobile right now so I'm not looking for it, but I feel like there's a page in the Django docs detailing exactly how to do this.
|
# ? Jul 4, 2018 15:56 |
|
mr_package posted:On MacOS, Path instances are PosixPath by default. That's pretty nutty... the OSX file system is case insensitve, I'd expect my Path/Glob library to treat pretend access the same. The Windows implementation does the downcase to emulate this, I assumed they did the same for OSX.
|
# ? Jul 4, 2018 17:27 |
|
Thermopyle posted:Basically. Django has one in the box, you use different ORM libraries with Flask. I ended up going with Django. Getting it set up on Windows Subsystem Linux was kind of a pain but not terrible. I’m probably going to write up instructions if anyone else would be interested in that
|
# ? Jul 4, 2018 22:45 |
|
Grump posted:I ended up going with Django. wouldnt it work just the same as regular ubuntu, or does Windowlinux's hilariously borked network stack preclude that?
|
# ? Jul 5, 2018 01:26 |
|
Yeah mostly the same but there’s some other dumb stuff that isn’t apparently obvious, such as creating a symlink between your windows and linux directories, so you can open your files in a text editor
|
# ? Jul 5, 2018 02:28 |
|
WSL support is huge but at the moment file permissions not transferring and the lack of systemd support meant I couldn't use it for development
|
# ? Jul 5, 2018 09:50 |
|
I'm trying to play around with __getattr__ and __setattr__ so that I can do something like the following:code:
I found this stackoverflow post and it's basically the same problem I am having. The help responses given there are extremely cryptic and not helpful at all. One person wrote some paragraphs explaining what was happening but nobody ever actually answers the question quote:So how would I go about this? I want precedence over the self implemented descriptors instead of always serving the self._field entries. – Yonathan Aug 30 '17 at 20:21 e: I would like to avoid implementing @property and @setters for everything. Boris Galerkin fucked around with this message at 11:47 on Jul 6, 2018 |
# ? Jul 6, 2018 11:44 |
|
|
# ? May 15, 2024 04:07 |
|
Is there a particular setup I should have for developing with Python on windows?
|
# ? Jul 6, 2018 14:48 |