Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
FoiledAgain
May 6, 2007

GrumpyDoctor posted:

Here's a total newbie question :ohdear:

How do I create a list of some given size populated with all the same element?

code:
[10]*5

>>> [10,10,10,10,10]

Adbot
ADBOT LOVES YOU

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Unless you're using NumPy, a list comprehension is probably the best way to do it. [10] * 5 will work but is a bad idea -- each element of that list will be a reference to the same object and this can come back to bite you in the rear end when you're not expecting it:

Python code:
>>> l1 = [[]] * 5
>>> l1
[[], [], [], [], []]
>>> l1[0].append(8)
>>> l1
[[8], [8], [8], [8], [8]]
>>> l2 = [[] for _ in range(5)]
>>> l2[0].append(4)
>>> l2
[[4], [], [], [], []]
Minor stylistic suggestion: it's a common Python idiom to use _ for a variable whose value you aren't interested in. PyCharm even suppresses the "unused variable" warnings for things named _.

EDIT: beaten; using [10] * 5 is okay only if you know that you're not making a list of anything mutable.

EDIT 2: FoiledAgain that is not Python REPL output :mad:

Lysidas fucked around with this message at 19:18 on Jun 6, 2012

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Don't do this if you want to build an actual application, as _ is commonly used to mark translatable strings:

Python code:
from gettext import gettext as _

print _("This is a translatable string!")
Also, if you didn't know, _ refers to the last thing executed in the Python REPL:

Python code:
>>> zip([1, 2, 3], 'abc')
[(1, 'a'), (2, 'b'), (3, 'c')]
>>> # oh poo poo I forgot to save that
>>> a = _
>>> a
[(1, 'a'), (2, 'b'), (3, 'c')]
>>> # phew.

FoiledAgain
May 6, 2007

Lysidas posted:

each element of that list will be a reference to the same object and this can come back to bite you in the rear end

Did not know this. Thanks!

quote:

EDIT 2: FoiledAgain that is not Python REPL output :mad:

Consider me properly chastised.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
I'm reading through O'Reilly's "Learning Python", 4th ed. I'm reading the chapter on numeric types, specifically the pages about the decimal module. The author seems to suggest setting setcontext().prec to 2 in order to do calculations with money. But from my experiments it seems like this sets the number of significant digits used for results, rather than the number of digits used to the right of the decimal point. For example, the following example is given in the book (slightly paraphrased):

Python code:
>>> import decimal
>>> decimal.getcontext().prec = 2
>>> decimal.Decimal(str(1999 + 1.33))
Decimal('2000.33')
But you can also do something like this, and lose the fractional part of a number:

Python code:
>>> import decimal
>>> decimal.getcontext().prec = 2
>>> decimal.Decimal('1999') + decimal.Decimal('1.33')
Decimal('2.0E+3')
Have I misunderstood something, or is the book giving really bad advice?

I'm running Python 3.2.3 on 64-bit Windows 7.

Emacs Headroom
Aug 2, 2003
Maybe you can use an integer for the dollars and a Decimal with fixed precision for the cents? Dunno, since the documentation clearly indicates that prec is precision and not digits past the decimal.

Maybe the book is just wrong.

Plus yeah:
Python code:
In [9]: decimal.getcontext().prec = 5

In [10]: print decimal.Decimal('1') / decimal.Decimal('7')
0.14286

In [11]: print decimal.Decimal('8') / decimal.Decimal('7')
1.1429

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
The book is giving terrible advice. Don't go mucking around with global constants like the decimal context precision, it will bite you right in the rear end.

Use integers, scaled to the level of precision needed. If you just need to work with cents and nothing smaller, then treat 100 as one dollar.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
That's what I thought.

I have another question. I understand that / performs division and yields a floating-point result, in Python 3.X. So I reasoned that if the operands are too large to be converted to floats, then the interpreter should fail to do the division, even if the result is something that can be represented comfortably as a float. But this is not what happens.

Python code:
>>> x = 2 ** 1501
>>> y = 2 ** 1500
>>> float(y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to float
>>> x / y
2.0
The division succeeds just fine even when x and y are coprime, so there are no clever factoring tricks to be done.

Python code:
>>> x = 2 ** 1500
>>> y = x + 1
>>> x / y
1.0
Is there some kind of magic happening that makes this work?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It could just be doing integer division and casting the result to a float.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
I believe it's doing the equivalent of float(Decimal(x) / Decimal(y))

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...
I have a set of data representing a probability distribution function stored as an array of arrays. I'd like to compute the cumulative distribution function (i.e. the sum of each element and all those proceeding it) for each row (and then another CDF of each row's total). Is there a clever way to do this using list comprehensions? Right now I've got

code:
pdf = get_data()
cdf = pdf
for row in range(0, len(pdf)):
  for col in range(1, len(pdf[r]):
    pdf[row][col] = pdf[row][col] + pdf[row][col-1]
which seems a bit clunky.

Modern Pragmatist
Aug 20, 2008

Hubis posted:

I have a set of data representing a probability distribution function stored as an array of arrays. I'd like to compute the cumulative distribution function (i.e. the sum of each element and all those proceeding it) for each row (and then another CDF of each row's total). Is there a clever way to do this using list comprehensions? Right now I've got

Python code:
pdf = get_data()
cdf = pdf
for row in range(0, len(pdf)):
  for col in range(1, len(pdf[r]):
    pdf[row][col] = pdf[row][col] + pdf[row][col-1]
which seems a bit clunky.

I would use numpy and cumsum:

Python code:
import numpy as np
pdf = np.array(get_data())

# The first thing you asked (2nd argument is axis)
cdf_rows = pdf.cumsum(1)


# The second thing you asked for
cdf = np.cumsum(np.sum(pdf,1))
On another note: Does anyone have a good reference about when to use unicode strings and when to use byte strings in Python 3? I'm trying to convert a project and I'm not sure what the best representation to use is.

Modern Pragmatist fucked around with this message at 13:28 on Jun 7, 2012

My Rhythmic Crotch
Jan 13, 2011

I have never used Python in any serious way before, and I decided that I would like to stream some data to the browser using Tornado.

My only feedback so far is that the way Python interprets indentations loving sucks rear end. UGH.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Stop using notepad.

vikingstrike
Sep 23, 2007

whats happening, captain
What do you mean the way it interprets indentations sucks rear end? As long as you are consistent, it shouldn't matter. Just set it in your text editor and forget about it.

My Rhythmic Crotch
Jan 13, 2011

I'm on a mac right now so no notepad :smugdog:

The specific situation was that I did not indent a couple lines below a method definition and the error messages produced were sufficiently confusing that I went looking all over hell and back before I found my simple mistake.

That is all, carry on.

spankweasel
Jan 4, 2006

Christ. Whining about indents in Python is about 15 years out of date. There are enough editors out there that know how to handle Python.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Isn't the message in this case reasonably clear? I'm legitimately curious about which cases cause Python to tell you something other than the following:

Python code:
def f(x):
return x * 2

print(f(2))
code:
$ python bad.py
  File "bad.py", line 2
    return x * 2
         ^
IndentationError: expected an indented block
I'm sure it can be a lot harder to interpret when you're new to the language and there's a lot more code than this, however.

etcetera08
Sep 11, 2008

who wants to talk about tabs vs spaces :twisted:

vikingstrike
Sep 23, 2007

whats happening, captain
Soft tabs forever.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

etcetera08 posted:

who wants to talk about tabs vs spaces :twisted:

One would think inciting a "discussion" about whitespace would be grounds for probation in a Python thread. :)

That said, I reckon semantic whitespace makes it a very good language learn on, as it forces the beginner programmer to make consistently laid out code. Breaking whitespace requirements requires them to make a conscious choice to do so, which means hopefully there's a decent reason to do so.

My Rhythmic Crotch
Jan 13, 2011

Here's the demo of my Tornado based monstrosity. Python part:
code:
#!/usr/bin/env python
#
# working on streaming data to browser

import tornado.httpserver
import logging
import tornado.escape
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.websocket
import os.path
import uuid

from tornado.options import define, options

define("port", default=8888, help="run on the given port", type=int)

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.render("index.html")

class wsHandler(tornado.websocket.WebSocketHandler):
    i = 0
    sockets = []
    scheduler = tornado.ioloop.PeriodicCallback
    def open(self):
        self.sockets.append(self)
        main_loop = tornado.ioloop.IOLoop.instance()
        self.scheduler = tornado.ioloop.PeriodicCallback(self.callback, 1000, io_loop=main_loop)
        self.scheduler.start()
        print "Websocket opened, timer started"
    
    def on_close(self):
        self.sockets.remove(self)
        self.scheduler.stop()
        print "Websocket closed, timer stopped"
    
    @classmethod
    def callback(self):
        for socket in self.sockets:
            socket.write_message("message " + str(self.i))
        print self.i
        self.i = self.i + 1

def main():
    tornado.options.parse_command_line()
    application = tornado.web.Application([
        (r"/", MainHandler),
        (r"/ws", wsHandler),
    ])
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(options.port)
    main_loop = tornado.ioloop.IOLoop.instance()
    main_loop.start()	# this should be the last line of your main function...


if __name__ == "__main__":
    main()
Web part:
code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <title>Tornado Demo</title>
  </head>
  <body>
    <div id="body">
      <div id="inbox"></div>
    </div>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
    <script>
        $(document).ready(function () {
            var ws = new WebSocket("ws://localhost:8888/ws");
            ws.onmessage = function(event) {
                document.getElementById("inbox").innerHTML = event.data;
            }
        });
    </script>
  </body>
</html>
It does work and it's the first thing I have made with Python. I'm very impressed with Python and Tornado!
Edit: it's just a demo, I can see at least one bug right away.

My Rhythmic Crotch fucked around with this message at 15:42 on Jun 7, 2012

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES

Lysidas posted:

There are a lot of ways to approach this, but I'd probably do something like the following:
code:
In [1]: class Student:
   ...:     def __init__(self, name, grade):
   ...:         self.name = name
   ...:         self.grade = grade
   ...:     def __repr__(self):
   ...:         return '{}: {}'.format(self.name, self.grade)
   ...:     

In [2]: classroom = {}

In [3]: classroom['Alex'] = Student('Alex', 86.5)

In [4]: classroom['Anne'] = Student('Anne', 90.0)

In [5]: classroom
Out[5]: {'Alex': Alex: 86.5, 'Anne': Anne: 90.0}

In [6]: classroom['Anne'].grade
Out[6]: 90.0
(maybe stealth) EDIT: Note that this is not what the __repr__ method is supposed to do ideally; I overrode it just to make pprinting classroom more informative.

vikingstrike posted:

^^Kind of beaten. His way works too.

I think it would be a little easier to do something like:

Python code:
>>> students = {}
>>> students["Alex"] = {'test1':85}
>>> students["Anne"] = {'test1':90}
>>> students
{'Anne': {'test1': 90}, 'Alex': {'test1': 85}}
>>> students["Alex"]["test1"]
85
>>> students["Anne"]["test1"]
90

Ridgely_Fan posted:

I would organize things a bit differently. For a set of things with members, I tend to use a list of dictionaries (unless they need associated methods, in which case I use classes).

It's easy to use list comprehensions on lists of dictionaries to get SQL-like behavior:

code:
In [1]: students = [{'name': 'Alex', 'Grade': 86.5}, {'name': 'Anne', 'Grade': 90.0}]

In [2]: print [s['Grade'] for s in students if s['name'] == 'Anne']
[90.0]
edit: it's also dead-simple to convert this to json or sqlite or whatever

edit2: if 99% of the time you're looking up info for a student by name, then you should do what the others said and make a big dictionary of students where the key is their name. If you need to look them up by other entries often though (like by their grades or their classroom etc.) then a list of dicts is better I think

Harm Barn Gumshoe posted:

Well I got hella beaten on code examples, but the big takeaway should be that you need to consider how you want your data to be stored (your "desired behavior" example was so close!). You need some kind of container to hold an individual student's information (after all, it's the student that has a Name or a Grade, not a classroom), THEN you can add them to a larger classroom container (so you can say "get the Grades from everybody in the classroom" etc.).

edit: heck, more code never hurt anyone, this was the example I was going to use (also shows how you can pretty easily make a dictionary almost any way you want)

Python code:
# Using dictionaries only
>>> student_list = [ {"Name":"Alex", "Grade":86.5}, 
{"Name":"Anne", "Grade":90.0}, 
{"Name":"some idiot", "Grade":0} ]
>>> classroom = dict()
>>> for student in student_list:
...     classroom[ student["Name"] ] = student
...
>>> classroom
{'Anne': {'Grade': 90.0, 'Name': 'Anne'}, 
'Alex': {'Grade': 86.5, 'Name': 'Alex'}, 
'some idiot': {'Grade': 0, 'Name': 'some idiot'}}
>>> classroom["Alex"]
{'Grade': 86.5, 'Name': 'Alex'}
>>> classroom["Alex"]["Grade"]
86.5
>>> for student_name in classroom:
...     student = classroom[student_name]
...     print student_name, "has a", student["Grade"]
...
Anne has a 90.0
Alex has a 86.5
some idiot has a 0

# Using classes
>>> class Student:
...     def __init__(self, name, grade=0):
...             self.name = name
...             self.grade = grade
...     def __str__(self):
...             return "%s, grade: %s" % (self.name, self.grade)
...     def __repr__(self):
...             return "<Student %s>" % (self.name,)
...
>>> Alex = Student("Alex", grade=86.5)
>>> Anne = Student("Anne", 90.0)
>>> Dunce = Student("some idiot")
>>> student_list = [Alex, Anne, Dunce]
>>> another_class = dict()
>>> for student in student_list:
...     another_class[student.name] = student
...
>>> print another_class
{'Anne': <Student Anne>, 'Alex': <Student Alex>, 'some idiot': <Student some idiot>}
>>> another_class["Anne"]
<Student Anne>
>>> another_class["Anne"].grade
90.0
>>> for student_name in another_class:
...     student_data = another_class[student_name]
...     print student_data
...
Anne, grade: 90.0
Alex, grade: 86.5
some idiot, grade: 0

Hey guys, I know this is a week+ late, but I wanted to thank y'all for all thr great responses to my question. I'm sorry I didn't respond earlier, I generally only read the python thread at work, and it's been very busy here lately. :(

IN any case, thanks again for all the great insights, and I'm looking forward to being able to incorporate this kind of thing into my codes to better recall data. :D

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES

My Rhythmic Crotch posted:

I have never used Python in any serious way before, and I decided that I would like to stream some data to the browser using Tornado.

My only feedback so far is that the way Python interprets indentations loving sucks rear end. UGH.

May I introduce you to Aquamacs?
http://aquamacs.org/

It's emacs, but you can actually use regular OSX commands (e.g. apple-c, apple-v) like a normal human being instead of using all the lovely emacs commands! I like it because I can use some of the *good* emacs things (e.g. rectangle deletion), but still use regular keyboard commands that most of us are used to.

etcetera08
Sep 11, 2008

JetsGuy posted:

May I introduce you to Aquamacs?
http://aquamacs.org/

It's emacs, but you can actually use regular OSX commands (e.g. apple-c, apple-v) like a normal human being instead of using all the lovely emacs commands! I like it because I can use some of the *good* emacs things (e.g. rectangle deletion), but still use regular keyboard commands that most of us are used to.

If you don't mind using the mouse you can do rectangle delete in most OS X text editors by holding Option and dragging. I don't have a Mac at the moment but I think it might work in MacVim too?

the
Jul 18, 2004

by Cowcaster
Let's say I want to use Enthought and IDLE.

On Windows:

1. Download executable install file.
2. Run it.
3. Enjoy your IDLE shortcut created on your desktop and all packages are installed!

On Linux:
1. Download enthought.sh package.
2. Figure out how to do anything with it. Wait, I have to go into the terminal? Okay.. now what? CHMOD? Okay. Now... I ran it I think? It unpacked something.
3. Let me try typing IDLE in the terminal now. Hmm, that doesn't work. Let me do some research online.
4. Okay someone says to do SUDO apt-get install idle. Okay that installed it I think.
5. Okay running IDLE. Great! Now let me try to use a simple package that was included with it like Pylab.
6. It doesn't have Pylab installed? :confused: :ughh:

And they wonder why no one uses Linux. Jesus Christ, I am going to throw this laptop out of the window.

:tenbux: to the first forum member who can get Enthought running properly on my laptop in Ubuntu, including all needed modules like pylab and all the parts that come with.

Emacs Headroom
Aug 2, 2003
If you're using Ubuntu you should use apt-get to install python packages (or the graphical thing, Synaptic I believe).

sudo apt-get install idle python-matplotlib

That should pull in numpy, scipy, and the pylab libraries. You might want to think about ipython as well (it's a nice shell for interactive python sessions).

edit: if there's another library you find isn't installed, search for it -- e.g.

code:
$ apt-cache search PIL
#lots of results, so let's find only python stuff
$ apt-cache search PIL | grep python
#less stuff and this thing in the middle:
python-imaging - Python Imaging Library
#so let's install it
$ sudo apt-get install python-imaging
#voila

Emacs Headroom fucked around with this message at 20:07 on Jun 7, 2012

vikingstrike
Sep 23, 2007

whats happening, captain
There are plenty of people that use Linux for development. In fact, I think it's easier/more straight forward to install modules from Linux than other OSes. To each their own.

This will probably help you:
https://svn.enthought.com/enthought/wiki/Install/ubuntu

edit: If you're unsure what to do with an enthought.sh file, your frustration with Linux is just a lack of familiarity with the environment it seems. .sh is the file extension of a shell script. All you should have needed to do is run 'sudo sh enthought.sh'. The script itself probably downloaded/installed things, but .sh itself is not a zip file, like you referred to.

Also, your linux distro should come with python out of the box. All you should have had to do is run 'python' from a terminal to go into the interactive shell. Like the last guy said, just use apt-get for most things.

vikingstrike fucked around with this message at 20:53 on Jun 7, 2012

Dirty Frank
Jul 8, 2004

vikingstrike posted:

There are plenty of people that use Linux for development. In fact, I think it's easier/more straight forward to install modules from Linux than other OSes. To each their own.

Especially for python, windows really doesn't play nice.

Modern Pragmatist
Aug 20, 2008

the posted:

Let's say I want to use Enthought and IDLE.

On Windows:

1. Download executable install file.
2. Run it.
3. Enjoy your IDLE shortcut created on your desktop and all packages are installed!

On Linux:
1. Download enthought.sh package.
2. Figure out how to do anything with it. Wait, I have to go into the terminal? Okay.. now what? CHMOD? Okay. Now... I ran it I think? It unpacked something.
3. Let me try typing IDLE in the terminal now. Hmm, that doesn't work. Let me do some research online.
4. Okay someone says to do SUDO apt-get install idle. Okay that installed it I think.
5. Okay running IDLE. Great! Now let me try to use a simple package that was included with it like Pylab.
6. It doesn't have Pylab installed? :confused: :ughh:

And they wonder why no one uses Linux. Jesus Christ, I am going to throw this laptop out of the window.

:tenbux: to the first forum member who can get Enthought running properly on my laptop in Ubuntu, including all needed modules like pylab and all the parts that come with.

Why would you expect pylab (matplotlib) to come installed with IDLE? You told it to install IDLE. Use Ridgely_Fan's advice. You always want to try to go with the stable version of software provided with the distro unless you have a very specific reason for installing a different version.

Also, Python development is a million times better on linux or OS X than windows. The kind of things you are complaining about will literally become second nature once you've done them once. And yes, you have to use the terminal so learn to embrace it. You may want to spend some time reading up on linux basics before blasting it.

epswing
Nov 4, 2003

Soiled Meat

the posted:

And they wonder why no one uses Linux. Jesus Christ, I am going to throw this laptop out of the window.

I hope you do a few years of python development in linux, so you can look back at this statement and laugh at yourself.

It's perfectly sane, you're just unfamiliar with it and throwing a fit because it doesn't behave the way you think it should.

the
Jul 18, 2004

by Cowcaster
I honestly hope so. Sorry if that whole post seemed stupid, but I was just banging my head in frustration at it. It just doesn't seem as intuitive as a Windows environment.

Emacs Headroom
Aug 2, 2003
Automated package managements is one of the best things about Linux / BSD / etc. It's very conceptually different from the Windows way of doing things, but if you're going to use Linux much at all it's very worth reading about :

http://library.linode.com/using-linux/package-management#sph_package-management-concepts

By the way, if my advice above helped, send my :10bux: to the Red Cross.

BigRedDot
Mar 6, 2008

the posted:

:tenbux: to the first forum member who can get Enthought running properly on my laptop in Ubuntu, including all needed modules like pylab and all the parts that come with.

Did you update your PATH and PYTHONPATH? EPD installs in a subdir in whatever random place you run the script. Did you try just "ipython --pylab" or even just "from pylab import *" ?

And IDLE... why on earth?

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

the posted:

I honestly hope so. Sorry if that whole post seemed stupid, but I was just banging my head in frustration at it. It just doesn't seem as intuitive as a Windows environment.

Windows is great if all you need is to install programs and run them in the default way. If you want to run a proper development environment set up just the way you like it, however, Linux is awesome once you know the ropes. Package management means the install steps for near god drat anything you need is apt-get install application and for the rest of the proprietary stuff, the shell scripts become second nature after a while, and there's no shortage of instructions out there.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
Even better, use OS X and you can have both!

OnceIWasAnOstrich
Jul 22, 2006

Sinestro posted:

Even better, use OS X and you can have both!

Oh god Python on OSX. I develop on a Mac Pro, and I was initially in love with it. That was until I actually started using a package manager. You get to choose fink or macports, and you better hope everything you want is on one of those, because god forbid you try to mix compiled programs with fink/port installed dependences or the other way around, much less between the two.

It also seems like every third library I try to install is just completely broken on 10.7, and requires me to either patch it myself or badger the developers into fixing it.

Using Python on OSX is a nightmare with package managers. Everything is beautiful if I download binaries or compile everything myself (except for the fact that you have to fight with the default system installed Python sometimes). I'm experimenting with using a Linux VM and just running everything in that either with ssh or PyCharm remote interpreters.

OnceIWasAnOstrich fucked around with this message at 00:10 on Jun 8, 2012

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

OnceIWasAnOstrich posted:

Oh god Python on OSX. I develop on a Mac Pro, and I was initially in love with it. That was until I actually started using a package manager. You get to choose fink or macports, and you better hope everything you want is on one of those, because god forbid you try to mix compiled programs with fink/port installed dependences or the other way around, much less between the two.

It also seems like every third library I try to install is just completely broken on 10.7, and requires me to either patch it myself or badger the developers into fixing it.

Using Python on OSX is a nightmare with package managers. Everything is beautiful if I download binaries or compile everything myself (except for the fact that you have to fight with the default system installed Python sometimes). I'm experimenting with using a Linux VM and just running everything in that either with ssh or PyCharm remote interpreters.

With pythonz and Homebrew, it is actually awesome. Fink/MacPorts are both huge clusterfucks, though.

the
Jul 18, 2004

by Cowcaster
I'm using IDLE, because, well, that's the first thing I used when I started on my Windows desktop so I'm used to it.

I'm doing physics programming, so I just need a GUI where I can code small programs that use Pylab/matplotlib/scipy/numpy. That's about it.

Adbot
ADBOT LOVES YOU

deimos
Nov 30, 2006

Forget it man this bat is whack, it's got poobrain!

the posted:

I'm using IDLE, because, well, that's the first thing I used when I started on my Windows desktop so I'm used to it.

I'm doing physics programming, so I just need a GUI where I can code small programs that use Pylab/matplotlib/scipy/numpy. That's about it.

Are you using IPython yet? You should.

  • Locked thread