Re: Chart drawing tool in python
On Apr 29, 9:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > In Perl, there is a GD module to draw custom chart. > > http://www-128.ibm.com/developerworks/opensource/library/os-perlgdcha... > > Can you please tell me if there is an equivalent library in python? > > Thank you. I've used PyChart in the past. Check out the Python wiki page on it to get started quickly. ---John -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie look at Python and OO
On May 10, 11:58 am, walterbyrd <[EMAIL PROTECTED]> wrote:
>[snip]
>
> 2) list assignment handling, pointing two vars to the same list:
>
> With simple data types:>>> a = 5
> >>> b = a
> >>> a = 3
> >>> a,b
>
> (3, 5)
>
> Which is what I'd expect, since I have changed a, but not b.
>
> But with lists:>>> a = list("1234")
> >>> b = a
> >>> a.append("5")
> >>> a,b
>
> (['1', '2', '3', '4', '5'], ['1', '2', '3', '4', '5'])
>
> b changes even though I have not touched b. I know why, but this is
> not what I would ordinarilly expect, it does not seem intuitive.
Well, although it may not be what you expect right now, it *is* quite
uniform with the rest of the language. That is: labels refer to
objects. Writing ``a = b`` just makes the 'b' label refer to the same
thing that the 'a' label refers to. Nice and simple.
> And,
> IMO, it gets worse:
>
> >>> a = list("1234")
> >>> b = a
> >>> a = a + ['5']
> >>> a,b
>
> (['1', '2', '3', '4', '5'], ['1', '2', '3', '4'])
Now here, after you've set 'a' and 'b' to refer to the same object,
you went and created a new object (a + ['5']) for a to refer to. ``a +
['5']`` creates a new object, whereas ``a.append('5')`` just modifies
the existing object. (By the way, as an aside, '5' is a one-character
string, not a number.)
> [snip]
>
> 3) ambiguous use of the form: this.that()
>
> Sometimes, this.that() means module.funcion() as in:
>
> >>> os.dirlist(".")
>
> Other times, "this" is sort of like a parameter to the "that"
> function:
>
> >>> a = list("1234")
> >>> "_".join(a)
>
> '1_2_3_4_5'
I think I see what you mean: In Python, there's this convention that
you're supposed to name your classes starting with a capital letter
(``class HeadCheese(object):``), but for core built-in classes, they
start with a lower-case letter (like ``list``, ``dict``, ``set``,
``file``, etc.). So, ``list('foo')`` is actually a constructor call.
Also, note that, in Python, "_" is a literal for creating a string
object, so you can call methods on that resulting object -- as in
``'_'.join('cheezit')`` -- the same as if you'd said ``foo = "_";
foo.join('cheezit')``.
> [snip]
>
> I'm not complaining. Python is a great language in many respects. But,
> I would take some issue with those claiming Python is intuitive and
> easy. IMO: there seems to be many ambiguous, unintuitve, and
> confusing, aspects to Python.
Well, every language has its warts. :) Folks are working to minimize
or remove a number of them for Python 3000.
---John
--
http://mail.python.org/mailman/listinfo/python-list
Re: append
On May 10, 1:11 pm, HMS Surprise <[EMAIL PROTECTED]> wrote: > Found list popping at > > http://en.wikibooks.org/wiki/Python_Programming/Lists:) You can find terse info on the list methods by doing: >>> help(list) ---John -- http://mail.python.org/mailman/listinfo/python-list
customary way of keeping your own Python and module directory in $HOME
What's the customary way to keep your own local Python and package directory? For example, when you're on a server where you don't have root access, and everything must go in your home directory. * What directories do you create? * What environment variables do you set? * What config files do you keep? * Does that setup work with distutils and setuptools? What special options do you need to pass to these tools when installing modules for everything to work right? Please, share your tips. -- http://mail.python.org/mailman/listinfo/python-list
Re: customary way of keeping your own Python and module directory in $HOME
On May 14, 6:00 pm, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > [snip], but on *nix, > you can compile python with the "--prefix=" option set to a directory in > your home dir and install there. Check. > I recommend having your own python install if you want a comprehensive > approach. Yup. I dropped the src in ~/src/Python-2.5.1, created a ~/py-2.5.1 directory, and did ./configure --prefix=/home/me/py-2.5.1 make make install and it worked fine. The only other step after that was creating a symlink: cd ln -s py-2.5.1 py and adding /home/me/py/bin to my $PATH. > Doesn't seem like hyper-paranoid sysadmining is all that efficient, does it? Well, on a server with many other users, they've pretty much gotta keep you confined to your home directory. My issues have been with keeping a ~/pylib directory for extra modules, and reconciling that with setuptools / Easy Install. I'm curious to hear how other folks manage their own local module directory. -- http://mail.python.org/mailman/listinfo/python-list
Re: Issue with MySQLdb wrapper
On May 15, 7:22 pm, Gerard M <[EMAIL PROTECTED]> wrote: > Hi guys I have a big problem with this wrapper im using Ubuntu 7.04 > and I want to install python-MySQLdb, I used synaptics and it is > installed, but when I try to do>>> import MySQLdb > > and I get this error: > > Traceback (most recent call last): > File "", line 1, in > File "MySQLdb/__init__.py", line 19, in > import _mysql > ImportError: No module named _mysql Looks like the install of MySQLdb is botched up. You might try and use the Ubuntu package management tool to check your installation for correctness. If that tells you everything is ok and it's still busted, you might try to uninstall, then reinstall MySQLdb. If that still doesn't work, you probably should ask about this on one of the Ubuntu forums. > so I tried to download it from the site and install it from the .tar > file but I failed because when I run > > #~/Desktop/MySQL-python-1.2.2$ python setup.py install > > [snip] In general, my guess is that, unless you have a good reason not to, you should probably not install fairly standard python packages by- hand like that on Ubuntu. There should be an Ubuntu package for what you need, and if there is, you should stick with that. If it fails, the Ubuntu folks will want to know about it. ---John -- http://mail.python.org/mailman/listinfo/python-list
