Two Plus Two Poker Forums

Two Plus Two Poker Forums (https://forumserver.twoplustwo.com/)
-   Computer and Technical Help (https://forumserver.twoplustwo.com/48/computer-technical-help/)
-   -   ** Python Support Thread ** (https://forumserver.twoplustwo.com/48/computer-technical-help/python-support-thread-1007515/)

daveT 11-28-2011 10:08 PM

Re: ** Python Support Thread **
 
Once you go command promp you never go back. Seriously, IDLE sucks. Ironically, slick GUI may draw you in, but after you program a while, you learn to despise GUI.

Gazillion 11-28-2011 10:58 PM

Re: ** Python Support Thread **
 
I'm still a newb too but I've always hated IDLE. Personally I prefer coding in a text editor (I use Textmate on Mac OS X) for writing scripts etc., and the command prompt/shell for just getting quick and dirty stuff done.

IDLE just feels clumsy/ugly/counter-intuitive to me.

Neko 11-28-2011 11:06 PM

Re: ** Python Support Thread **
 
Idle is not very good and I doubt that anyone uses it for serious coding, but it is a pretty good way to get started with Python since it requires no setup or separate install.

I personally either use emacs or WingIDE (professional version, intellisense & debugger with Wing are awesome and it comes with emacs key bindings).

Xhad 11-29-2011 01:21 AM

Re: ** Python Support Thread **
 
Once my laptop started running slowly and I decided to check Task Manager and saw page after page of processes that IDLE spawned for some reason I still haven't figured out. I thought about manually killing them all but lost count at something like 110. I finally ended up restarting the damn thing.

On a related note, I just found out gedit has a python console plugin. If only I could figure out a way to run my saved python scripts from within it in windows...

e i pi 11-29-2011 02:05 AM

Re: ** Python Support Thread **
 
intradesting

tyler_cracker 11-29-2011 01:16 PM

Re: ** Python Support Thread **
 
i use vim + bash. some guys at work like pyscripter.

daveT 11-29-2011 09:49 PM

Re: ** Python Support Thread **
 
If I wasn't too lazy / stupid, I would code Python in Emacs, but fml, the setup for Windows is way too difficult for that. There's like 3 downloads plus you have to change the Emacs file to do correct indents and paths and getting it all to work can't be possible. Just not that interested atm.

Xhad 11-29-2011 10:02 PM

Re: ** Python Support Thread **
 
I looked at it and came to the same conclusion. The stuff that would make Gedit worth it appears to not exist in Windows at all. It really sucks that I haven't seen anything I like enough to switch from terrible IDLE, but the problem is that I'm the only person who ever runs any of my scripts and I spend more time explaining the output in papers than actually coding it so I don't have the motivation to set up anything even slightly complicated. I would probably be burning less time by just saying "**** it" and restarting my laptop every so often, lol

Neko 11-29-2011 10:16 PM

Re: ** Python Support Thread **
 
emacs takes about 5 minutes to set up on windows...

daveT 11-29-2011 11:09 PM

Re: ** Python Support Thread **
 
Really? Everything I've found says download ropemacs, pymacs, some other stuff, fix the .emac file, point here point there... Ah screw it. I'll research again. :(

Neko 11-29-2011 11:23 PM

Re: ** Python Support Thread **
 
Yeah, that's true. If you install all the goodies it can be a major pain in the arse that will have you pulling your hair out.

I was just talking about barebones emacs which has a passable python mode that works okay.

If you want the grandaddy emacs setup look here: https://github.com/pdee/pdee

Most of the hard work is done for you and it shouldn't be too bad to set up although I haven't done it yet since I already had most of the stuff cobbled together myself.

daveT 11-29-2011 11:43 PM

Re: ** Python Support Thread **
 
Yeah, but what do I learn by installing that?

It's more than I remember. Of course I'll work through it one day. If e i pi is interested in posting a TR:

http://www.emacswiki.org/emacs/?acti...rammingInEmacs

Neko 11-29-2011 11:48 PM

Re: ** Python Support Thread **
 
What did you learn installing your current text editor?

Xhad 11-30-2011 12:21 AM

Re: ** Python Support Thread **
 
Apparently emacs doesn't natively support Python versions > 3.0, or at least that's what its error messages just told me.

Neko 11-30-2011 12:28 AM

Re: ** Python Support Thread **
 
I don't use 3 but it looks like it should be easy enough to get running from a bit of googling around.

e i pi 11-30-2011 03:35 PM

Re: ** Python Support Thread **
 
I took a programming course like 7 years ago and for some reason think I remember learning that you shouldn't use If without Else...

Is this true or am I making things up?

tyler_cracker 11-30-2011 03:54 PM

Re: ** Python Support Thread **
 
definitely not true. completely context-dependent.

TheIrishThug 11-30-2011 04:19 PM

Re: ** Python Support Thread **
 
I'd have a lot of empty else blocks if that were the case.

Xhad 11-30-2011 08:32 PM

Re: ** Python Support Thread **
 
The closest thing I can think of is the general advice against doing stuff like this in C:

Code:

if (condition)
    do_stuff();

Because it has the potential to turn into:

Code:

if (condition)
    foo = bar;
    do_stuff();

And now "do_stuff()" is no longer conditional and that may go unnoticed. Python's indenting rules make this impossible though.

Neko 11-30-2011 09:37 PM

Re: ** Python Support Thread **
 
That's usually more of a reason to always use curly braces then always have an if statement right?

I would always write :
Code:

if (condition) {
    do_stuff();
}

Can't see any reason to always use an else statement and Stack Overflow says no too :)

Xhad 11-30-2011 10:12 PM

Re: ** Python Support Thread **
 
huh, that link is surprising to me. I was working from the assumption that e i pi was misremembering his programming class from 7 years ago and just named the closest thing I can think of. I never would have assumed that someone might have actually told him that.

EDIT: ROFL: http://stackoverflow.com/a/2042730 Note the followup.

Xhad 12-06-2011 01:38 AM

Re: ** Python Support Thread **
 
Re: the editor discussion earlier, I think I may finally settle on Notepad++ with this thing: http://mpcabd.igeex.biz/notepad-plug...ython-scripts/

scrolls 12-06-2011 12:09 PM

Re: ** Python Support Thread **
 
kind of a noob to python so apologize if this is a dumb question:

>x = 'sss'
>x.count('ss')
1

whats the easiest way for me to count 'ss' in this string and have the result be 2? it seems count only counts the first 'ss' whereas i need it to also count the second 'ss' that overlaps the first 'ss', if that makes sense.

e i pi 12-06-2011 01:03 PM

Re: ** Python Support Thread **
 
I'm just a noob but you could use the fact that x[0],x[1],x[2] are all = 's' and write code to loop through and count the number of times x[n] and x[n+1] are equal to 's'

scrolls 12-06-2011 01:47 PM

Re: ** Python Support Thread **
 
Quote:

Originally Posted by e i pi (Post 30232477)
I'm just a noob but you could use the fact that x[0],x[1],x[2] are all = 's' and write code to loop through and count the number of times x[n] and x[n+1] are equal to 's'

ty, was able to figure it out thanks to this thought.


All times are GMT -4. The time now is 11:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.

Copyright © 2008-2020, Two Plus Two Interactive