Author Topic: Anyone use Python?  (Read 15805 times)

JaWiB

  • definitelys definately no MacGyver
  • Jackass V
  • Posts: 1443
  • Karma: +57/-4
Re: Anyone use Python?
« Reply #30 on: February 27, 2012, 09:49:50 PM »
Oh, nice, thanks!

-KEN-

  • Some Other Mofo
  • Jackass In Charge
  • Posts: 1001
  • Karma: +75/-100
Re: Anyone use Python?
« Reply #31 on: February 28, 2012, 01:53:33 AM »
You may be tempted to start writing

from ls331 import *

This is generally frowned about. Python people have a hard-on for explicit imports.

-KEN-

  • Some Other Mofo
  • Jackass In Charge
  • Posts: 1001
  • Karma: +75/-100
Re: Anyone use Python?
« Reply #32 on: February 28, 2012, 01:56:49 AM »
Re: debugging, you can use this -- http://docs.python.org/library/pdb.html

I'm more a traceback-and-tinker sort of debugger ;)

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Anyone use Python?
« Reply #33 on: May 13, 2012, 11:42:38 PM »
I just started playing with Python again and I'm enjoying it for the most part. I'm using the Flask framework and I think Python is a step up from PHP. Some of the language quirks bother me but overall I think it's worth learning more. What I really wish was out there was a Groovy syntax language that didn't require a JVM and was more like PHP/Python.
This signature intentionally left blank.

webwhy

  • Jackass IV
  • Posts: 608
  • Karma: +15/-10
Re: Anyone use Python?
« Reply #34 on: May 14, 2012, 10:29:14 AM »
in my opinion you're describing Ruby (MRI or CRuby).  faster startup than JVM with the C based interpreter.  It's implementation and language syntax was a big inspiration for Groovy's, especially concerning blocks, which make all of the awesome collection stuff possible.

Code: [Select]
# sum squares from 1 to 10
1.upto(10).map { |num| num**2 }.reduce(0) { |sum, num| sum += num }
« Last Edit: May 14, 2012, 04:45:14 PM by webwhy »

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Anyone use Python?
« Reply #35 on: November 05, 2012, 11:23:34 PM »
So after spending some serious development time with Python I've grown quite fond of it. There are still a few silly things but I keep figuring out ways to get around things.

Like the Elvis operator in Groovy where the value gets used if it evaluates to true:
def max = params.max ?: 10

Can be done similarly and perhaps more readable in Python:
max = params.max or 10

I'm almost done with a functional prototype of a cloud based PBX system using the Tropo WebAPI that I build using Python with Flask, WTForms, SQLAlchemy (and a few others) setup. After spending some time playing with Go (golang) I like the toolkit (library) approach vs full on convention framework. For smaller apps that don't use many of the framework features it just makes the apps seem bulky. And since I'm becoming a big fan of an API micro-app design mentality, the smaller frameworks fit better into that, only pull in what you need. I think once I get a little bit better feel for the development I'm going to try and start making some helper packages that I can pull in and get going even quicker. It seems rather easy to setup a skeleton application to start from.

In another week or so I might have a demo for you guys to play with for the PBX system. I'm pondering where to host it at the moment. I sort of want to give AppEngine a shot but it will probably live on a box in my office for a little bit.
This signature intentionally left blank.

JaWiB

  • definitelys definately no MacGyver
  • Jackass V
  • Posts: 1443
  • Karma: +57/-4
Re: Anyone use Python?
« Reply #36 on: November 06, 2012, 12:53:35 AM »
PBX?

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Anyone use Python?
« Reply #37 on: November 06, 2012, 08:15:57 AM »
Phone system. Think virtual receptionist. Often companies need to buy hardware and phones but really, why bother if everyone has mobiles and might not even be in the office at all. And this system could be on demand in a matter of minutes.
This signature intentionally left blank.

Mike

  • Jackass In Charge
  • Posts: 11248
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: Anyone use Python?
« Reply #38 on: November 30, 2012, 12:19:06 AM »
This last weekend I wrote my first non-trivial python script to pull xml data from a website and add relevant data to a Google spreadsheet.  Today I started working on a python task at work.  I'm really starting to warm up to it.  I really did the list comprehension stuff.

Mike

  • Jackass In Charge
  • Posts: 11248
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: Anyone use Python?
« Reply #39 on: December 02, 2012, 11:29:03 PM »
Found one area where python is really lacking compared to php:  date/time handling.  It is so freaking awesome to drop a string into strtotime() and be done with parsing it.  Even with the dateutil 3rd party lib I'm still running into problems with python.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Anyone use Python?
« Reply #40 on: December 03, 2012, 12:10:39 AM »
Java is the same way.  I fucking hate dealing with dates in Java.

Perspective

  • badfish
  • Jackass In Charge
  • Posts: 4635
  • Karma: +64/-22
    • http://jeff.bagu.org
Re: Anyone use Python?
« Reply #41 on: December 03, 2012, 08:26:40 AM »
Java is the same way.  I fucking hate dealing with dates in Java.

SimpleDateFormat ?  You just specify the format as a String and it parses it as a Date.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Anyone use Python?
« Reply #42 on: December 03, 2012, 09:27:27 AM »
Eh... maybe I haven't used that one?  I have been using Calendar and Date.  I know Date is deprecated so I've been trying to use Calendar.  Again... Java provides so many classes to do the same damn thing, that you often don't know the best one to use.

Perspective

  • badfish
  • Jackass In Charge
  • Posts: 4635
  • Karma: +64/-22
    • http://jeff.bagu.org
Re: Anyone use Python?
« Reply #43 on: December 03, 2012, 09:52:30 AM »
yeah man, don't use Date. I haven't tried Calendar, but SimpleDateFormat is probably what you're looking for
http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Anyone use Python?
« Reply #44 on: December 03, 2012, 11:34:39 AM »
Java is the same way.  I fucking hate dealing with dates in Java.

on a somewhat unrelated note, I was getting really annoyed with Javascript for a project recently that had a LOT of date formatting so I made a function that works just like the PHP Date function that I know and love.

https://gist.github.com/4120120

kinda off topic, but just thought I'd share
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."