Re: When Python should not be used?

2008-10-06 Thread jdd
On Oct 5, 8:08 pm, Andrea Francia <[EMAIL PROTECTED]
HERE.ohoihihoihoih.TO-HERE.gmx.it> wrote:
> The right tool depends on the current problem.
>
> While some python users prefer to talk about when Python is the right
> tool I think that it is more instructive to know when it is not.
>
> Please, could you let me know what do you think about that?
>
> Thanks
> --
> Andrea 
> Franciahttp://andreafrancia.blogspot.com/2008/07/colinux-linux-dentro-window...

In my experience, Python is not suitable for extremely resource-
intensive stuff where speed is a large priority, unless you're
comfortable with the C api. The vast majority of applications that
people are writing are nowhere near pythons limitations.
--
http://mail.python.org/mailman/listinfo/python-list


Re: managing releases of web applications: is svn checkout the best way?

2008-10-07 Thread jdd
On Oct 7, 3:55 am, Ksenia <[EMAIL PROTECTED]> wrote:
> Hi,
>
> For website development, I am using SVN repository to commit the code
> from my development computer, and on the production server use svn
> checkout to update the code to the latest version.
> Is this the most common approach people using? Or is there maybe a
> better way to manage "live" releases, like creating an egg for each
> release? Assuming the code is closed-source and should be kept secure.
>
> Just wondering how you people deal with that.
> Thanks
> Ksenia

I think it's a pretty common means of doing releases.

I use bzr, one of the distributed Version Controlling Systems, with a
webapp I wrote using cherrypy. It works out rather well as I don't
have to deal with setting up svn as a server (or deal with svns
quirks). Also, since branching is rather cheap in VCSs (at least in
all the ones that I'm aware of), I have a much "safer" workflow.

My workflow looks like this:

1. Branch from server to implement feature
2. Implement and commit on local machine
3. From server, merge in changes from local machine.

This has worked well for me on projects that involved multiple people
as well, as long as they kept up to date. I imagine that a lot of
other peoples workflows are similar.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to do regular BASH work in Python?

2008-10-09 Thread jdd
On Oct 9, 10:13 am, Frantisek Malina <[EMAIL PROTECTED]> wrote:
> Hey,
> I found it. Python rocks:http://www.python.org/doc/2.5.2/lib/os-file-dir.html
>
> If you have any further links that provide some lively code examples
> and recipes, please pass them on.
>
> Thank you
>
> Frank Malinahttp://vizualbod.com

http://examples.oreilly.com/python3/ has some good examples, although
they may be a little tough to read through if you don't have a copy of
"programming python", the book they're from.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Append a new value to dict

2008-10-13 Thread jdd
On Oct 13, 7:21 am, Pat <[EMAIL PROTECTED]> wrote:

> Is there a better/easier way to code this in Python than the
> obtuse/arcane setdefault code?

foo = {'bar': 'baz'}
foo.update({'quux': 'blah'})
--
http://mail.python.org/mailman/listinfo/python-list


Re: IDE Question

2008-10-15 Thread jdd
On Oct 15, 1:19 pm, "Steve Phillips" <[EMAIL PROTECTED]> wrote:
> Hi All,
> I am just wondering what seems to be the most popular IDE. The reason
> I ask is I am currently at war with myself when it comes to IDE's. It
> seems like every one I find and try out has something in it that
> others don't and viceversa. I am in search for the perfect IDE and
> after many months of searching, I always come back to IDLE to do what
> I need to do. I want to use Komodo badly but the one issue I have with
> that is sometimes the auto-complete works and other times it doesn't.
> Even if I carbon copy a script.
>
> Thanks in advance,
> Steve P

I would personally recommend that you take the time to learn your way
around a powerful text editor such as emacs or vim (I use emacs,
myself), however that may not fit well with your personal editing
tastes, and the learning curve is a bit steep. The editing tastes
problem can be solved once you learn your way around a powerful text
editor (emacs, for instance, is practically infinitely customizable),
and the power you get from using them is amazing.

If you're set on using an IDE, the python wiki link that other people
have linked to has a decent overview of good options.
--
http://mail.python.org/mailman/listinfo/python-list


Re: IDE Question

2008-10-15 Thread jdd
On Oct 15, 2:13 pm, "Fabio Zadrozny" <[EMAIL PROTECTED]> wrote:
> Now, following that route, many people call Eclipse is the 21st
> century Emacs... ;-)
>

I don't want to kick off an editor war or anything, but I don't think
that Eclipse is anywhere near being a 21st century emacs, unless
there's been a whole lot of progress with it since the last time I
used it. With emacs, I can have multiple files open in one window,
with the window split (I don't remember eclipse being able to do this,
although it allowed multiple files in their own tabs), and I can
customize the actions of the editor on the fly, without restarting it,
in a variant of LISP. That may be possible in Eclipse, I don't really
know.

I used to use Eclipse and pydev, but once I learned my way around
emacs, I haven't gone back to it for anything. I probably would if I
did any coding in Java - but I don't. I'm exponentially more
productive with emacs while writing python code than I ever was with
Eclipse.

Add to that the degree to which emacs is customizable (just about
everything that the editor does can be customized, you can jump
quickly to the source of the functions you're running while editing,
you can easily patch behavior in before or after specific function
calls, you can easily define keyboard macros and bind them to
keystrokes, and / or save them for future use, you can easily create
keystrokes that correspond to interactive filling out of templates -
"skeletons", etc), and I really don't see how someone could think that
Eclipse is anywhere near being a replacement for emacs.

Not to mention that I don't need to have X installed to run emacs if I
don't need it.

I may be wrong about the capabilities of Eclipse, as I haven't used it
in about a year, and emacs certainly has it's own set of quirks and
annoyances - one of which being the very steep learning curve.

Watching the screencasts linked in the blog post you linked to, I
might prefer Eclipse to emacs if I wasn't very used to never touching
a mouse, or if I was developing under windows. With my editing mindset
the way it is right now, when I see that, I just see a lot of wasted
screen space, and a lot of wasted time doing things like intellisense.
Also, the blog post didn't really give any reasons as to _why_ the
person switched over, other than that they were impressed with
Eclipse.

Meh, I'm not talking trash on Eclipse - it's a fine tool if it fits
how you work with text / code. It's just not for me, and I would feel
crippled while using it if I switched back to it. I used IDEs like
that for a few years, but after about a month and a half of using
emacs, I haven't looked back. I even use it as my IRC client when I
jump on IRC.

I do think that people should try a variety of styles of editors to
find what works best for them though - although it does take a lot of
time to learn your way around 3 or 4 different editors, once you find
what fits with you, you will probably get a huge boost in productivity.
--
http://mail.python.org/mailman/listinfo/python-list


Re: IDE Question

2008-10-15 Thread jdd
On Oct 15, 3:47 pm, "Fabio Zadrozny" <[EMAIL PROTECTED]> wrote:
> You should be able to have it having multiple views for the same
> file: although it does that by doing a new editor, and then you can
> place that new editor as you want -- below some existing, to the
> right, etc -- or you can use an external plugin for something more
> closer to what emacs 
> has:http://wiki.eclipse.org/Implement_Split_File_Editor_Functionality_for...
> -- note: I don't personally use that -- usually I try to keep the
> modules small ;-)

Nah, I don't mean having multiple views for the same file, I mean
having multiple files open where I can see them all at once easily,
without tabs. I also keep modules small, but a lot of times I want to
be able to edit multiple files really quickly. When I'm doing web-dev
stuff (with cherrypy), I'll generally have my python source, css,
javascript, and html templates open at once, so I can quickly add a
feature and tweak stuff. I like emacs' buffer/window/frame paradigm a
lot.

> Depends on what you 
> want:http://fabioz.com/pydev/manual_articles_scripting.html(but that's
> just one of lots of ways to customize it)

Yeah, I'm the type of user that like to be able to totally gut and
customize everything about the tool I'm using, and in emacs, the
underlying behavior is a keystroke away if you want it to be.

> I must say that I'm totally the other way around... even being
> productive in emacs, there's really no comparison there for me
> (disclaimer: I'm the author of Pydev, so, that's expected, but I know
> many people that changed to it and say the same thing)

Hey, you did an awesome job with Pydev - I got a lot of really good
use out of it when I still used Eclipse, and I'm sure that a lot of
people are really grateful for your work. It's a seriously awesome
tool for Python development with Eclipse, and I have fond memories of
it even though I don't use Eclipse anymore.


> The one thing I miss in Eclipse (for which I use notepad++) is the
> macros, but that's about it... Everything else is highly customizable
> for me in Eclipse / Pydev... everything else is there (templates,
> keybindings, jumping through code: going fast to any file/definition
> you want in your project, hyperlinking in console, etc)

I make very heavy use of keyboard macros, and although they're
difficult to master in emacs, once I got the hang of them I got the
ability to really make large-scale modifications of a codebase
quickly. I have sets of macros for specific languages, and specific
projects. I'm sure that there are equivalent ways to have as much
editing power in Eclipse (or any other competent editor).

> Also, I don't think outside of Eclipse there's anything close to what
> Mylyn gives you in terms of knowing what code is really important when
> working on a task (http://www.eclipse.org/mylyn/).

I hadn't heard of mylyn, and it looks like a pretty powerful, nice
tool.

> Eclipse also has that -- And I'm pretty sure that the more you use a
> tool the more you get productive in it.

Yes, absolutely. Tools like text/code editors always have a lot to
learn, and you can be hugely productive with just about any of them.


> Also, as I said in the other post, choosing where you'll develop it's
> a highly subjective thing, so, the right thing to do is look the
> options, try them and decide for yourself.
>

This really is the crux of the "which editor should I use" issue -
there's no one correct answer for everybody. People who think
otherwise are wrong, IMO.

> > I do think that people should try a variety of styles of editors to
> > find what works best for them though - although it does take a lot of
> > time to learn your way around 3 or 4 different editors, once you find
> > what fits with you, you will probably get a huge boost in productivity.
>
> Totally agree with that.
>
> Cheers,
>
> Fabio

Absolutely. We are, I think, on the same page as far as the choice of
editor problem goes. It's somewhat analogous to the choice of
programming language issue, although not quite. I guess the lesson
here is to give each of the major editors a chance, and see what works
out for you. When I started using emacs, once I went through the
tutorial and read through some of the docs, it "clicked" for me. It's
certainly not an editor for everybody - for one, it's made in a way
where you are expected to customize it's behavior. The default
behavior in emacs is not suitable to most people - the defaults are
something of a bare-bones "yeah you can get some stuff done" mode of
editing, and it can be very frustrating until you get used to
modifying it. Eclipse is much closer to what (I imagine) most coders
are used to, especially if they come from a windows-centric
background. I personally used Eclipse while I was still learning my
way around a linux environment, and now my workflow and setup is so
different than what it was in windows that I feel utterly lost /
crippled when I'm on a windows box. Emacs fits my style of c