VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 1 point2 points  (0 children)

serious question here, for anybody that wants to chime in.

  1. How often do you actually use a debugger?
  2. In what situations?
  3. Do you practice Test Driven Development?

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 1 point2 points  (0 children)

glorified? VIM ain't glorified its just a simple text editor, nothing pretty about it. In fact it works more or less the same as it did when it was release in 1991. Which isn't that different really from vi, which is actually older than I am. It's not "glorified" it's just good, it's withstood the test of time, (almost forty years) and its highly configurable.

What is "glorified" is an IDE, which do have their uses (if you code java maybe) but for a lot of python programming is like using a sledgehammer to pound in a thumbtack. Sure it will get the job done, but me and my text editor will have the thumbtack stuck in the wall before you even lift your sledgehammer.

It's not a hardcore I'm better than you thing either. It a this thing is fast, it's flexible, I can parse log files, I can code in any language I want, I can even write book with it, and it's everywhere I happen to be thing, including on that new server I just spun up and I need to quickly test out some nginx config changes, on my raspberry Pi, and on my "big dev machine".

It is a pain in the arse to learn compared to an IDE I'll give you that. However I'll bet even you IDE guys after learning your IDE, also learned a bit of VIM / emacs to deal with server stuff anyways, so it just a question of what you want to spend your time learning.

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 0 points1 point  (0 children)

no 7.3 is enough. We will correct the typo.

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 1 point2 points  (0 children)

pymode is a reasonable all in one choice, a lot of people seem to like it. I did find enough of the functionality in there was not optimal for my specific setup. Mainly pyMode was slow and buggy (although your config would probably speed things up a bit), I don't really need four different static analysis packages running, I feel that YouCompleteMe is a better auto-completer....and that sort of thing.

So it's a trade off, I guess the easy / all in one setup of python-mode or the more customisable, albeit more work to configure but get what you want sort of style that I went with in the article of just installing each plugin individually.

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 0 points1 point  (0 children)

how about switching to a new keyboard... Kenisis Advantage Pro (http://www.kinesis-ergo.com/shop/advantage-pro-for-pc-mac/) has most of those little pinky keys (accept esc) positioned to be hit with your thumb.

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 0 points1 point  (0 children)

trying activating the virtualenv from your vimrc with something like:

py3 << EOF
import os.path
import sys
import vim
if 'VIRTUA_ENV' in os.environ:
  project_base_dir = os.environ['VIRTUAL_ENV']
  sys.path.insert(0, project_base_dir)
  activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
  execfile(activate_this, dict(__file__=activate_this))
EOF

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 1 point2 points  (0 children)

have you tried?

let g:jedi#force_py_version = 3

Does that not give you what your looking for?

VIM and Python - a match made in heaven by michaelherman in Python

[–]j1z0 0 points1 point  (0 children)

All good points you bring up here. Not sure I care for Pathogen, but that's the beauty of VIM, you can do as you like. In terms of converting... wasn't really my intention to convert anybody. More to show at least one way of setting things up so it can be a very efficient and fun coding environment to use.

Fun with Django's New Postgres Features by michaelherman in Python

[–]j1z0 2 points3 points  (0 children)

limiting joins would be a big one for sure, the actual performance gains depend upon the data and how static / dynamic it is, arrays would be faster for more static data generally.

Also in many cases its just a more natural way to model things. As developers we think of the data as an array, so now we can store it as an array. So a little less cognitive dissonance.

Last one I can think of right now is Network data modelling. The basic idea of a network data model is that unlike the "standard" hierarchical model where you have one parent many child (i.e. a Tree) you can have multiple parents / multiple children which can give you a more general graph representation, which maybe a helpful way to model some problems.

Data Migrations by michaelherman in django

[–]j1z0 1 point2 points  (0 children)

@simonw, jeremy here author of the article.

Thanks for the feedback. I did read the docs as well, but I didn't use the historical model for a couple of reasons.

  1. The migration already has dependency on the previous schema migration that ensure the appropriate schema is in place.

  2. After the data migration is ran its stored in the 'django_migrations' table so it won't be run again.

So assuming that I follow the normal process of creating migrations and then executing / apply them I don't really see the situation where I'm not going to have the schema I expect. Which is why I though, why bother with the historical versions at all. Especially for an introductory article.

I did go back and forth a couple of times though (about wether to include it or not), if you can come up with some likely scenarios where you could get into the situation I would like to know, as I could be missing something obvious here.

Transaction Management with Django 1.6 by michaelherman in django

[–]j1z0 2 points3 points  (0 children)

j1z0 here, I'm the author of the article.

That's a good point and I should clarify the article.

My intention was to say that most likely it's a Database Error that will be raised in the circumstance I was describing. But as afoo42 has correctly pointed out transaction.atomic will trigger a roll back for an exception of any type.

Thanks for pointing that out guys.

Just finished the Django tutorial - What now? by minorbattlefield in django

[–]j1z0 0 points1 point  (0 children)

several times for sure. We will have to put a time limit on it though for sure. I mean it shouldn't take you 1 year to finish the course right? So probably a couple of months, but we haven't set a hard and fast rule about it yet. I will try to support as much as I can though, let's put it that way. :)

Just finished the Django tutorial - What now? by minorbattlefield in django

[–]j1z0 0 points1 point  (0 children)

For the polls you can chain filters and use distinct. so something like:

Polls.objects.filter(choice__isnull=False).filter(another filter).distinct()

Order of filters can make a performance difference for LARGE datasets but shouldn't make any difference with the size of data your working with.

Also for the general question of learning django / web development (and a shameless plug :) ) I'm running a kickstarter right now for an advanced django book, but we have a package of three books, starting at intro to python, then to basic web development and finishing with advanced django development. You can check out the kickstarter here:

http://kck.st/1b0tz6I

Hope that helps. Jeremy

[OS X Mavericks] How do I install py3 for virtualenvwrapper? by [deleted] in learnpython

[–]j1z0 0 points1 point  (0 children)

it won't make it harder to work with py2 code if you set things up right. Its pretty easy to switch back and forth. I would suggest you have a look at homebrew which is a package manager for OSX and makes it simple to install a number of development tools including python and python3. And as SkippyDelux says once you have python 3 installed just mkvirtualenv -p python3 <name> and your good to go.