Re: How to get live streaming of friends tweets??

2010-04-23 Thread Florian Diesch


http://arstechnica.com/open-source/guides/2010/04/tutorial-use-twitters-new-real-time-stream-api-in-python.ars
has some explanations about how to use real-time stream API 

eka (Esteban) ekagauranga...@gmail.com writes:

 IMO the real time update is your work to do.

 You can poll, to say, each 1 minute or less and then you will have
 your real time tweets update.


 On Apr 14, 9:08 am, Harshad Joshi firewal...@gmail.com wrote:
 import twython.core as twython, pprint
 import codecs

 # Authenticate using Basic (HTTP) Authentication
 twitter = twython.setup(username='yourname', password='yourpassword')
 friends_timeline = twitter.getFriendsTimeline(count=60, page=2)

 a=codecs.open('twython_log.txt','a','utf-8')
 for tweet in friends_timeline:
         print \n+tweet[user][screen_name]++ tweet[text]
         d=\n+tweet[user][screen_name]++ tweet[text]
         a.write(d)

 a.close()

 This is the code I wrote but I doubt if its a live stream i am
 receiving.

 I wanted some real time updates from my friends. The above code
 fetches data from the 'latest' friends tweet and continues till 60th
 tweet. It doesent do anything about the new tweet that might come from
 someone.

 On Apr 11, 9:34 pm, Atul Kulkarni atulskulka...@gmail.com wrote:

  Hi Harshad,

  It depends on what you want those updates for? If it is a client then you
  will have to stick with the methods you have described but if you are
  writing and server end application then you can think of using streaming 
  api
  with follow predicate. This will feed in to your application live updates
  from the people you are following. But do not use streaming api if you
  thinking of a client, as streaming API could be overwhelming for the client
  side application.

  Tweepy has code examples, which should help you with the sample code. Just
  my 2 cents.

  Regards,
  Atul.

  On Sat, Apr 10, 2010 at 12:34 AM, Harshad Joshi 
  firewal...@gmail.comwrote:

   In the original twitter api, there was a method like

   a=twitter.Api('user','password')

   b=a.GetFriendsTimeline()

   where we could get the friends time line after authentication. It used
   to show maximum 20 tweets at a time.

   Is there any similar method available in tweepy which will show live
   updates? If yes, then what is the maximim number of tweets being
   shown?

   I would like to see a code snippet of the above method.

   --
   To unsubscribe, reply using remove me as the subject.

  --
  Regards,
  Atul Kulkarni


   Florian
-- 
Simple dict-like Python API for GConf:
http://www.florian-diesch.de/software/easygconf/ 

-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: easygconf 0.03

2010-02-16 Thread Florian Diesch


I'm happy to announce easygconf 0.03

Get it at http://www.florian-diesch.de/software/easygconf/


Changes since 0.02:
---

 * renamed GConfDict.add_listner() to add_listener()
 * fixed bug in GConfDict.from_python() (thanks to Pawn Hearts pawn13 at 
gmail.com)




easygconf provids an easy, pythonic way to access GConf
http://projects.gnome.org/gconf/`__ through a dict-like interface.

Example
---
::

from easygconf import GConfDict
import gtk


key = 'test
gc=GConfDict('/apps/easygconftest')

print %s is %s%(key, gc[key])
gc[key] = 'foo'
print Now %s is %s%(key, gc[key])


def callback (key, value, gconfdict, id, args):
print %s changed to %s%(key, value)

gc.add_listener('test', callback)
try:
gtk.main()
except KeyboardInterrupt:
pass
gc.unset('test')



   Florian
-- 
GUIs programmieren mit Python und Glade:
http://www.florian-diesch.de/doc/python-und-glade/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Rounding up to the next 100

2010-01-21 Thread Florian Diesch
noydb jenn.du...@gmail.com writes:

 If one has a floating number as a string, is there a spiffy way to
 round that string-number UP to the nearest 100?

 XstrNmbr = 3579.127893 -- would want to round that to 3600.

math.ceil(3579.127893/100)*100


   Florian
-- 
GUIs programmieren mit Python und Glade:
http://www.florian-diesch.de/doc/python-und-glade/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Florian Diesch
Nico Grubert nicogrub...@gmail.com writes:

 Hi there

 I have the following list 'mylist' that contains some dictionaries:

 mylist = [{'title':'the Fog', 'id':1},
   {'title':'The Storm', 'id':2},
   {'title':'the bible', 'id':3},
   {'title':'The thunder', 'id':4}
  ]

 How I can sort (case insensitive) the list by the dictioary's 'title' key?

mylist.sort(key=lambda x: x['title'].lower())



   Florian
-- 
http://www.florian-diesch.de/software/easygconf/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread Florian Diesch
Jorgen Grahn grahn+n...@snipabacken.se writes:

 Regarding the book's title: is it just me, or are Python programmers
 in general put off when people call it scripting?

 I won't attempt a strict definition of the term scripting language,
 but it seems like non-programmers use it to mean less scary than what
 you might think of as programming, while programmers interpret it as
 not useful as a general-purpose language.

For me scripting means something like task automation within a given
program or environment, in contrast to wring a stand-alone program.


   Florian
-- 
http://www.florian-diesch.de/software/easygconf/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: restructuredText editor ?

2010-01-08 Thread Florian Diesch
Peter vm...@mycircuit.org writes:

 What editor do people out there use to edit .rst files for
 sphinx-python documentation ?

Emacs with ReST mode and  YASnippet


   Florian
-- 
http://www.florian-diesch.de/software/pdfrecycle/
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: easygconf 0.02

2009-11-16 Thread Florian Diesch


I'm happy to announce easygconf 0.02.
Get it at http://www.florian-diesch.de/software/easygconf


easygconf provids an easy, pythonic way to access GConf
through a dict-like interface.

Example
---

from easygconf import GConfDict
import gtk


key = 'test
gc=GConfDict('/apps/easygconftest')

print %s is %s%(key, gc[key])
gc[key] = 'foo'
print Now %s is %s%(key, gc[key])
 
def callback (key, value, gconfdict, id, args):
print %s changed to %s%(key, value)

gc.add_listner('test', callback)
try:
gtk.main()
except KeyboardInterrupt:
pass
gc.unset('test')




   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Distributing Python-programs to Ubuntu users

2009-09-25 Thread Florian Diesch
Ben Finney ben+pyt...@benfinney.id.au writes:

 Olof Bjarnason olof.bjarna...@gmail.com writes:

   - any geeks visiting my blog that are non-Ubuntu (i'll just provide
 the source code and tell them to apt-get python-pygame)

 Note that for several years now the recommended command-line tool for
 package installation is not ‘apt-get’, but ‘aptitude’ [0]. 

That's only true for Debian but not for Ubuntu; the official
Ubuntu Server guide uses apt-get: 
https://help.ubuntu.com/9.04/serverguide/C/httpd.html


   Florian
-- 
http://www.florian-diesch.de/software/pdfrecycle/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ubuntu dist-packages

2009-08-27 Thread Florian Diesch
Robin Becker ro...@reportlab.com writes:

 Florian Diesch wrote:
 .

From /usr/lib/python2.6/site.py:

 ,
 | For Debian and derivatives, this sys.path is augmented with directories
 | for packages distributed within the distribution. Local addons go
 | into /usr/local/lib/pythonversion/dist-packages, Debian addons
 | install into /usr/{lib,share}/pythonversion/dist-packages.
 | /usr/lib/pythonversion/site-packages is not used.
 `

 the above is not present in my windows documentation (or indeed
 site.py) at all so it seems they just decided to change the
 name. Anyone trying to debug why their distutils or setuptools or
 whichever python packager is going wrong will have yet another detail
 to remember. 

setuptools works fine for me in Ubuntu 9.04; eggs go to
/usr/local/lib/python2.6/dist-packages/ like they should according to site.py

 In addition, as any one who has done such trivial changes
 will already know, they forgot to do it globally eg my 0.4.1.0 version
 of the Debian Python Policy document explicitly mentions
 site-packages.

It's a change for the Python 2.6 package, see
http://packages.debian.org/changelogs/pool/main/p/python2.6/python2.6_2.6.2-2/changelog
and /usr/lib/python2.5/site.py

Python 2.6 is only in Debian experimental, I guess there is a new
version of the Debian Python Policy coming.



   Florian
-- 
http://www.florian-diesch.de/software/pdfrecycle/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ubuntu dist-packages

2009-08-26 Thread Florian Diesch
Robin Becker ro...@reportlab.com writes:

 I was surprised a couple of days ago when trying to assist a colleage
 with his python setup on a ubuntu 9.04 system.

 We built our c-extensions and manually copied them into place, but
 site-packages wasn't there. It seems that ubuntu now wants stuff to go
 into lib/python2.6/dist-packages.

 What is the relation between dist-packages/site-packages if any? Is
 this just a name change or is there some other problem being
 addressed?

 For developers is it best just to create one's own private
 installations from the original tarballs?

From /usr/lib/python2.6/site.py:

,
| For Debian and derivatives, this sys.path is augmented with directories
| for packages distributed within the distribution. Local addons go
| into /usr/local/lib/pythonversion/dist-packages, Debian addons
| install into /usr/{lib,share}/pythonversion/dist-packages.
| /usr/lib/pythonversion/site-packages is not used.
`




   Florian
-- 
http://www.florian-diesch.de/software/pdfrecycle/
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: easygconf 0.01

2009-07-23 Thread Florian Diesch

I'm happy to announce easygconf 0.01


Get it at http://www.florian-diesch.de/software/easygconf/

easygconf provids an easy, pythonic way to access GConf
http://projects.gnome.org/gconf/ through a dict-like interface.



Example
---

 from easygconf import GConfDict
 gc=GConfDict('/apps/test-application')

 gc['title']
 gc['title']='Hello world!'
 gc['title']
'Hello world!'

 gc['list']=range(3)
 gc['list']
(0, 1, 2)

 gc.unset('title')
 gc.unset('list')
 gc['title']
 gc['list']

 gc.sync()




   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: pdfrecycle 0.05

2009-06-17 Thread Florian Diesch

I'm happy to announce pdfrecycle 0.05

Get it at http://www.florian-diesch.de/software/pdfrecycle/


pdfrecycle creates a PDF file by composing pages from other PDF
files. It can add PDF bookmarks and metadata, scale, rotate and crop
pages and put multiple logical pages onto each physical sheet.

pdfrecycle uses a simple text file format to define the layout and
what pages to include. From this input file pdfrecycle creates a LaTeX
file and then runs pdflatex to produced the PDF file.


With version 0.05 you can put pages of different input files on one
output sheet and/or cut of parts of input pages.





   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: Peggy 0.02

2009-03-29 Thread Florian Diesch


I'm pleased to announce Peggy 0.02

Get it at http://www.florian-diesch.de/software/peggy/


What is Peggy?
===
Peggy helps you to create GTK applications that run out-of-the-egg.

It offers functions to load ressources (like .glade files, images, locales)
from a (zipped or unzipped) egg.

Peggy is a thin layer on top of setuptools and PyGtk. It's not doing
much fancy stuff but can save you from reading some docs ;-)





   Florian
-- 
http://www.florian-diesch.de/
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: xxgamma 0.06

2009-03-19 Thread Florian Diesch


I'm happy to announce xxgamma 0.06

Get it at http://www.florian-diesch.de/software/xxgamma/


xxgamma is an PyGTK based GUI for xgamma which allows you to load,
modify and store multiple gamma correction profiles for XFree86 and
X.org through a GUI and a command line interface.


Version 0.06 fixes some bugs and adds Undo and some minor GUI improvements



   Florian
-- 
http://www.florian-diesch.de/
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: Peggy 0.01

2009-03-05 Thread Florian Diesch

I'm pleased to announce Peggy 0.01

Get it at http://www.florian-diesch.de/software/peggy/


Peggy helps you to use resources inside a package, especially
resources used by PyGtk classes, like images or glade files. It works
for zipped eggs or packages just somewhere in sys.path.

Peggy is a thin layer on top of setuptools and PyGtk. It's not doing
much fancy stuff but can save you from reading some docs ;-)




   Florian
-- 
http://www.florian-diesch.de/
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


firkin 0.02

2008-10-15 Thread Florian Diesch

I'm happy to announce release 0.02 of firkin
http://www.florian-diesch.de/software/firkin/



What is firkin?
===

   firkin is a python module to convert between different measurement
   units.

Status
==

   firkin is alpha software. So far it seems to work for me but it may
   have severe bugs I didn't noticed yet. Use it at your own risk.

   Firkin is still under development and the API may change in the future.

Requirements


   firkin only needs the Python standard lib

License
===

   GPL




   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: formating a filesystem with python

2008-09-11 Thread Florian Diesch
Ricardo Tiago [EMAIL PROTECTED] wrote:

 is there a package in python that allows to mount/umount and format
 (to ext3) a filesystem? I know that this is possible by just calling
 the os commands 'mount/umount and mkfs' but this would imply to have
 to change sudoers to run the script as non-root.

On Linux (I guess thats the target OS as you mentioned ext3) mounting
could be done as non-root using FUSE or HAL (maybe using a frontend
like gio or kio) if the system supports that, or with an appropriate
fstab entry. 

Maybe HAL can configured to do mkfs but that has to be done very
carefully to avoid security problems.

Maybe you could use something like AppArmor, too.

Most likely you get better answers by first asking in a Linux group
how to do this things without root privileges and then come back to
ask how to do it with Python.



   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-30 Thread Florian Diesch
John Nagle [EMAIL PROTECTED] wrote:

Perl has CPAN, which is reasonably comprehensive and presents modules
 in a uniform way.  If you need a common Perl module that's not in the
 Perl distro, it's probably in CPAN. Installing a new module can be as
 simple as typing perl -MCPAN -e 'install Chocolate::Belgian'.
 So Perl has exactly that.

Python's Cheese Shop is just a list of links to packages
 elsewhere.  There's no uniformity, no standard installation, no
 standard uninstallation, and no standard version control.

Python has easy_install


   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: dream hardware

2008-02-13 Thread Florian Diesch
Jeff Schwab [EMAIL PROTECTED] wrote:

 On Feb 12, 2008 1:05 PM,  [EMAIL PROTECTED] wrote:
 What is dream hardware for the Python interpreter?

 Warren Myers wrote:
 A Cray?

 What are you trying to do? dream hardware is a very wide question.

 The only dream hardware I know of is the human brain.  I have a
 slightly used one myself, and it's a  pretty mediocre Python
 interpreter.

It comes without any documentation, the source code is not available
and has lots of known bugs that did't get fixed for ages. The typical
crap from a monopolist. 


   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux Journal Survey

2008-02-04 Thread Florian Diesch
Albert van der Horst [EMAIL PROTECTED] wrote:

 In article [EMAIL PROTECTED],
 Russ P. [EMAIL PROTECTED] wrote:
On Jan 23, 7:42 pm, George Sakkis [EMAIL PROTECTED] wrote:
 On Jan 23, 8:14 pm, [EMAIL PROTECTED] wrote:

  The annual Linux Journal survey is online now for any Linux users who
  want to vote for Python.  http://www.linuxjournal.com/node/1006101

 ...

 18. What is your favorite programming language?

 (15 choices, Python not included)

 19. What is your favorite scripting language?

 o Python

 o Perl

 (5 more choices)

 Python is much more than a scripting language (whatever this means,
 other than a semi-derogatory term used by clueless PHBs). Sorry, I'll
 pass.

 George


Someone please correct me if I am wrong, but I think of a Python
script as a flat source file with no (or few) functions or classes,
whereas a full-blown program has functions and classes. Both have
their place.

I agree it is unfortunate that the Linux World poll classified Python
as a scripting language. I suspect they did that because Python is
not (typically) compiled and does not have static typing.

 In the context of linux a programming language is
 a language that generates an ELF binary executable to be stored
 in a /.../bin/ directory.
 A scripting language is a language whose programs are normally
 distributed in human-readable form. It is appropriate to call

So a scripting language is a language that is usually used for Open
Source software while a programming language is usually used for
ClosedSource software?

What kind of language has C been in the good old days when gcc
produced aout binaries instead of ELF?

 such a program a script. If the first two characters is #!
 and the execution bit is set, it is a script in the linux sense.

Thanks to the binfmt_misc kernel module you can execute python byte 
code just like you execute native code:

[EMAIL PROTECTED]:~% bin/hello 
Hello world!
[EMAIL PROTECTED]:~% file bin/hello
bin/hello: python 2.5 byte-compiled
[EMAIL PROTECTED]:~% head -n1 bin/hello 
³ò

 So as far as I can tell it boils down to a clear technical
 distinction

IMHO it's neither a clear nor a useful one.


   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: where do my python files go in linux?

2008-01-13 Thread Florian Diesch
Jorgen Bodde [EMAIL PROTECTED] wrote:

 I am trying to make a debian package. I am following the tutorial by
 Horst Jens 
 (http://showmedo.com/videos/video?name=linuxJensMakingDebfromSeriesID=37)
 and it is very informative. However one thing my app has and his
 doesn't, is multiple python files which need to be executed. For
 example

 {dir}/app
 app.py

 app.py calls a lot of modules in {dir}/app. Horst says the python file
 goes in /usr/bin/app.py which is ok with me, but I have multiple
 python files, and I decided to use an app.sh script to call my python
 files. In the /usr/bin I do not see subdirs so I assume that is not
 really desirable.

 Question 1. Where do I put the bulk of python scripts in a normal
 linux environment?
 Question 2. Should I use *.pyc rather then *.py files to speed up
 executing as the user cannot write to /usr/bin or any other dir in the
 system and everytime my app runs it will recompile it

 Thanks for any advice or maybe a good tutorial how to set up files in
 a linux environment

Have look at the Debian Python Policy
(should be in /usr/share/doc/python/python-policy.* on
Debian systems)






 With regards,
 - Jorgen


   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: exception message output problem

2007-12-23 Thread Florian Diesch
Lie [EMAIL PROTECTED] wrote:


 # Python have an odd (read: broken) singleton implementation
 # single member tuple must have a comma behind it

Otherwise (1+2)+(3+4) would evaluate to (3, 7) instead of 10.

   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem untaring python2.5

2007-12-20 Thread Florian Diesch
abhishek [EMAIL PROTECTED] wrote:

 Hi everyone , i am not able to untar python 2.5 source code using 
 tar -xvzf  . Is it a problem with my system settings or python 2.5
 itself.

 When i tried to do it it resulted in following errors --

 tar: Skipping to next header
 Python-2.5/Mac/Resources/app/Resources/English.lproj/Documentation/ide/
 new_window_made.gif
 tar: Python-2.5/Mac/Resources/app/Resources/English.lproj/
 Documentation/ide/new_window_made.gif: Cannot open: No such file or
 directory

tar can't write the unpacked files because the directory they belong to
doesn't exist. Most likely that's because tar can't create the
directory either.

Do you have write permission for the directory where you want to unpack
to? Can you create the directory Python-2.5 by hand (mkdir Python-2.5)?




   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pydoc - how to generate documentation for an entire package?

2007-12-20 Thread Florian Diesch
kirillrd [EMAIL PROTECTED] wrote:

 On Nov 20, 4:28 pm, Jens [EMAIL PROTECTED] wrote:
 On 20 Nov., 08:19, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:

  On Mon, 19 Nov 2007 10:50:28 -0800, Jens wrote:
   Generating documentation form code is a nice thing, but this pydoc.py
   is driving me insane - isn't there are better way?

  Epydoc!?

  Ciao,
  Marc 'BlackJack' Rintsch

 Thanks! Epydoc looks promising - shame about the user interface
 though :-(

 There is also happydoc , much less features , but still nice :-)

I like apydia http://apydia.ematia.de/


   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to protect my new commercial software.

2007-12-12 Thread Florian Diesch
farsheed [EMAIL PROTECTED] wrote:

 Thanks. But I ask this question technically, I mean I know nothing is
 uncrackable and popular softwares are not well protected. But my
 software is not that type and I don't want this specific software
 popular.
 It is some kind of in house tool and I want to copy protect it. 

Insert some code that tests for something that's special in your
company's environment. 

In a networked environment create a simple license server, e.g. one that
uses asymmetric encryption to encrypt incoming data and sends it back to
the client. Your program then send some random data to the server and
decrypts the answer using the server's public key.


Of course that just protects against someone just taking away a copy but
not against reverse engineering.



   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Distinguishing attributes and methods

2007-12-11 Thread Florian Diesch
MonkeeSage [EMAIL PROTECTED] wrote:

 It seems that I've got a short-circuit somewhere here. I understand
 that everything is an object and the the storage/lookup system is
 object-agnostic, and that it is only the descriptors (or tags as I
 called them generically) that determine how an attribute is bound,
 whether it is bound at all, whether it is even callable, and so forth.
 So, when I say that all callable attributes (or to be more precise,
 all callable attributes bound to objects other than toplevel) are
 methods, what am I missing?

 You said the difference [between a callable attribute and a method]
 is the specific implementation of the attribute's class...but this
 almost sounds like type-by-primitive (a method is a method when it
 derives from a certain base class), or type-by-behavior (a method is a
 method when it behaves in a certain way, e.g., responds in a certain
 way to a query). Is this correct? Shouldn't it be type-by-capability/
 interface--i.e., it implements the protocol of a callable, therefore,
 formally, it is not meaningfully different from any other callable
 (quacks like a duck and all)?

 I guess what I'm asking is, in what way is a method (or function)
 semantically different from a home-brewed callable I concoct and bind
 to an object (or toplevel)? What is the distinction that I'm missing?



--8---cut here---start-8---
#!/usr/bin/env python

class Foo(object):

def __init__(self):
def func(*args):
return str(args)
self.a=func

def b(*args):
   return str(args)

@classmethod
def c(*args):
return str(args)



f=Foo()
print f.a(1)   # just a callble
print f.b(1)   # an instance method
print f.c(1)   # a class method
--8---cut here---end---8---



   Florian
-- 
http://www.florian-diesch.de/
---
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python re expr from Perl to Python

2007-01-07 Thread Florian Diesch
Michael M. [EMAIL PROTECTED] wrote:

 In Perl, it was:


   ## Example: Abc | def | ghi | jkl
   ##   - Abc ghi jkl
   ## Take only the text betewwn the 2nd pipe (=cut the text in the 1st
 pipe).
   $na =~ s/\ \|(.*?)\ \|(.*?)\ \|/$2/g;

   ## -- remove [ and ] in text
   $na =~ s/\[//g;
   $na =~ s/\]//g;
   # print DEB: \$na\\n;


 # input string
 na=Abc | def | ghi | jkl [gugu]
 # output
 na=Abc ghi jkl gugu


 How is it done in Python?

 import re
 na=Abc | def | ghi | jkl [gugu]
 m=re.match(r'(\w+ )\| (\w+ )\| (\w+ )\| (\w+ )\[(\w+)\]', na)
 na=m.expand(r'\1\2\3\5')
 na
'Abc def ghi gugu'



   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: alternate language

2006-12-15 Thread Florian Diesch
Bryan [EMAIL PROTECTED] wrote:

 what is a good alternate language to learn? i just want something to
 expand my mind and hopefully reduce or delay any chance of
 alzheimer's. i would especially like to hear from those of you who
 learned python _before_ these languages.

 haskell, erlang, ocaml, mozart/oz, rebel, etc.

I did a little bit Haskell at university. IMHO it's a very interesting
language to expand your mind. I never used it for real programming
though.


 i don't require any of these features, but extra browny points for any
 of the following:

 interactive interpreter

HUGS

 batteries included

Not with the standard library but AFAIK GHC comes with alot of things

 can integrate with c

AFAIK there are some tools

 compiles to native code

GHC

 can use a gui toolkit such as wx

AFAIK there are at least Gtk bindings

 doesn't take 60 hour weeks over years to master

It may take you some time get the idea of pure functional programming
(no loops, no assignment, ...)


   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to choose the right GUI toolkit ?

2006-11-11 Thread Florian Diesch
Dan Lenski [EMAIL PROTECTED] wrote:

 So, is there another toolkit I should be looking at?  Having something
 that can run easily on Cygwin and native Windows is a priority so that
 I can quickly move programs to new measurement computers.  I like GTK a
 lot and Tk is growing on me too.. are there any higher-level wrapper
 toolkits for GTK and Tk?

For Gtk there's Kiwi http://www.async.com.br/projects/kiwi/



   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python tools for managing static websites?

2006-11-04 Thread Florian Diesch
Chris Pearl [EMAIL PROTECTED] wrote:

 Are there Python tools to help webmasters manage static websites?

 I'm talking about regenerating an entire static website - all the HTML
 files in their appropriate directories and sub-directories. Each page
 has some fixed parts (navigation menu, header, footer) and some
 changing parts (body content, though in specific cases the normally
 fixed parts might change as well). The tool should help to keep site
 editing DRY every piece of data, including the recurring parts, should
 exist only once.


Tahchee http://www.ivy.fr/tahchee 

SUMMARY = Automated static and dynamic web site creation tool 
DESCRIPTION = \  
Tahchee is a tool for developers and Web designers that makes it possible to
easily build a static Web site using the Cheetah template system. It is used to 
fill in the gap between bare template and macro processing system and dynamic   
template-based Web sites. It acts both as a build system (à la make) as well  
as an extension to the Cheetah template that makes it really easy to build small
to medium-sized sites. It is ideal for writing open source project or small 
company Web sites.\ 
  



   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: People's names (was Re: sqlite3 error)

2006-10-17 Thread Florian Diesch
Hendrik van Rooyen [EMAIL PROTECTED] wrote:

 Lawrence D'Oliveiro [EMAIL PROTECTED] wrote:


 In message [EMAIL PROTECTED], Hendrik van
 Rooyen wrote:

  Lawrence D'Oliveiro [EMAIL PROTECTED] wrote:
 
  8
 
  I wonder if we need another middle field for holding the bin/binte
  part (could also hold, e.g. Van for those names that use this).
 
  NO! - I think of my surname as van Rooyen - its only a string with a
  space in it - and its peculiar in that the first letter is not
  capitalised
 
  And I am sure that the people called von Kardorff would not agree
  either...

 So do the Dutch phone books have a lot of entries under V, then?

 It just seems less efficient to me, that's all.

 Don't know about what happens in Holland - my ancestors came over here to 
 South
 Africa a long time ago -
 a mixed up kid I am - Dutch and French from the time of the revocation of the
 edict of Nantes...
 And yes, here the phone books are sorted that way - the van Rensburgs 
 precede
 the van Rooyens. And what is worse, there are a lot of van ders too - two
 spaces in the string like van der Merwe who are preceded by van der Bank  
 -
 van basically means from - like the German von - but in Germany its an
 appellation applied to the nobility - 

In Germany von is just a part of the name since 1919 when the nobility
was abolished by law. In the local phonebook it seems it's up tgo the
people how they want to be sorted. I see e.g. both von Fürstenberg,
Ulrich and Fürstenberg, Constantin von.


 and in my name it makes no sense as Rooyen is not a place - its a
 strange archaic derivative of the colour red - rooij' in Dutch, spelt

In Germany names like that were created when a commoner was
ennobled. There is a von Roth in the lokal phonebook (roth is an
archaic spelling of rot which means red)



   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ideas for programs?

2006-06-04 Thread Florian Diesch
Brandon McGinty [EMAIL PROTECTED] wrote:


 I've been learning python for the past couple of months and writing
 misc scripts here and there, along with some web apps.
 I'm wondering if anyone has ideas of programs I might try my hand at making?

Something I wanted a few days ago: I have a graph described in the .dot
language (used by GraphViz http://www.graphviz.org) and want you get
things like shortest path between two nodes, all paths between two
nodes, all cycles and whatever graph theory knows as interesting. 


   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python - Web Display Technology

2006-05-19 Thread Florian Diesch
bruno at modulix [EMAIL PROTECTED] wrote:

 SamFeltus wrote:
 I am trying to figure out why so little web development in Python uses
 Flash as a display technology.  It seems most Python applications
 choose HTML/CSS/JS as the display technology, yet Flash is a far more
 powerful and elegant display technology.  On the other hand, HTML/JS
 seems clunky and antiquated.  I am a gardener, and not a coder by
 trade, but Flash seems to integrate just fine with Python.  Anyways,
 what are the technical reasons for this?
 

 - Flash is a proprietary technology requiring a proprietary plugin.

There seem to be at least two free implementations:

Package: libswfdec0.3
Description: SWF (Macromedia Flash) decoder library
 A decoder library for Macromedia Flash animations, which are often
 found on web sites.  This is the run-time portion of the library.

Package: libflash0c2
Description: GPL Flash (SWF) Library - shared library
 The GPL Flash library is a set of functions that can be used by
 applications to play Flash movies. The core of the library is a
 portable graphic renderer that can be used to add SWF support to an
 application.
 .
 This package contains shared libraries needed to run programs
 that have been build against the library.



 - There aint actually no working Flash plugin for Mozilla on a 64bit
 processor - I just *can't* read Flash anims on my computer

There are plugins based on the above libs. Maybe they work on 64 bit
platforms.


 - Flash is meant to display animations, not web content
 - Flash content is not indexed by search engines
 - Flash content cannot be manipulated by normal text/HTML/XML tools

- In Flash you can't set bookmarks
- In Flash you can't use your browser's navigation functions
- You can't print animations


 (x)html/css/js is neither 'clunky' nor 'antiquated' 

http://www.csszengarden.com/ is a nice example what you can do with
pure HTML and CSS


   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python rounding problem.

2006-05-13 Thread Florian Diesch
Thomas Bartkus [EMAIL PROTECTED] wrote:

 Grant Edwards [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 On 2006-05-08, Thomas Bartkus [EMAIL PROTECTED] wrote:

  does python support true rations, which means that 1/3 is a
  true one-third and not 0.3 rounded off at some
  arbitrary precision?
 
  At risk of being boring  ;-)
 
  - Python supports both rational and irrational numbers as
floating point numbers the way any language on any digital
computer does - imprecisely.
 
  A true (1/3) can only be expressed as a fraction.

 At the risk of being both boring and overly pedantic, that's
 not true.  In base 3, the value in question is precisely
 representable in floating point: 0.1

  As soon as you express it as a floating point - you are in a
  bit of trouble because that's impossible.

 It's not possible in base 2 or base 10.  It's perfectly
 possible in base 9 (used by the Nenets of Northern Russia) base
 12 (popular on planets where everybody has twelve toes) or base
 60 (used by th Sumerians).  [I don't know if any of those
 peoples used floating point in those bases -- I'm just pointing
 out that your prejudice towards base 10 notation is showing.]

  You can not express (1/3) as a floating point in Python any
  more than you can do it with pencil and paper.

 That's true assuming base 2 in Python and base 10 on paper. The
 base used by Python is pretty much etched in stone (silicon, to
 be precise).  There used to be articles about people working on
 base-3 logic gates, but base-3 logic never made it out of the
 lab. However, you can pick any base you want when using paper
 and pencil.

  You can be precise and write 1/3 or you can surrender to
  arithmetic convenience and settle for the imprecise by writing
  0.3, chopping it off at some arbitrary precision.

 Or you can write  0.1
  3

 :)

 Ahhh!
 But if I need to store the value 1/10 (decimal!), what kind of a precision
 pickle will I then find myself while working in base 3 ?  How much better
 for precision if we just learn our fractions and stick to storing integer
 numerators alongside integer denominators in big 128 bit double registers ?

 Even the Nenets might become more computationally precise by such means ;-)
 And how does a human culture come to decide on base 9 arithmetic anyway?

Just guessing: 
 * Use one thumb to point at one of the other 9 fingers
 * Every finger (except for the thumb) has 3 segments (and links), each
   of which can easily divided in three part (upper, middle, lower or left
   middle, right for the links) making 9 points for each finger.


 Even base 60 makes more sense if you like it when a lot of divisions come
 out nice and even.

You can count to 60 using two hands: Use the right thumb to point on
one of the 12 segments of the remaining 4 fingers and on the left hand
one finger for each dozen.


Of course this is wasting resources as you can count to 1023 with your
fingers. I never heard of a culture doing so, though.



   Florian
-- 
http://www.florian-diesch.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hooking things up in GUI application

2006-04-29 Thread Florian Diesch
Ryan Ginstrom [EMAIL PROTECTED] wrote:

 Behalf Of sturlamolden
 If you use PyGTK (it also runs on Windows), you can design 
 the GUI with
 GLADE and then use libglade to import the gui as an xml-resource.

 Yes, I've tried something similar with wxGlade. Nice, but it doesn't seem to
 remove the most tedious work -- hooking up handlers (although it does help
 here, at the cost of some behind-the-scenes magic), and getting data into and
 out of GUI widgets. 

Kiwi http://www.async.com.br/projects/kiwi/ looks promising, but it is
under heavy development and you have to learn it by examples.



   Florian
-- 
Emacs hat den weiten Weg von krank, nur krank bis komisch hinter sich.
[David Kastrup in [EMAIL PROTECTED]]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: detecting drives for windows and linux

2006-03-29 Thread Florian Diesch
[EMAIL PROTECTED] (Alex Martelli) wrote:

 Florian Diesch [EMAIL PROTECTED] wrote:
...
  are and want to do it anyway?) Linux puts the whole file system 
  (including mounted iPods, ISOs and NTFS drives) in one hierarchy.
 
  Yes, but you may still want to distinguish (because, for example, hard
  linking doesn't work across filesystems, and mv is not atomic then).
 
 Why not use os.stat?

 Each os.stat call gives you information about one file (or directory);
 it may be simpler and faster to get the information in bulk once and
 for all.

Depends on what you want to do. Offen you need informations like file size,
permissions or owner in any case.


For things like creating hardlinks it may be the best to just try it and
catch the exception.


  Running a df command is a good simple way to find out what drives are
  mounted to what mountpoints -- the mount command is an alternative, but
  its output may be slightly harder to parse than df's.
 
 Executing df may be expensive if it needs to read some slow file systems.

 That's what the -n flag is for, if you're worried about that (although
 I believe it may not be available on all systems) -- 

GNU df doesn't have it.
Some of the various version of df at Solaris don't have it too. And they
have at least two different output formats.


 executing mount
 is the alternative (just putting up with some parsing difficulties
 depending, e.g., on what automounters may be doing).

I would prefer mount as ir is cheaper than df

 Reading /etc/mtab is not difficult and much faster

 $ cat /etc/mtab
 cat: /etc/mtab: No such file or directory

Ok, wasn't that clever. On Solaris it's /etc/mntab, I don't have any BSD around

 Oops!  BSD systems don't have /etc/mtab... so, if you choose to get your
 info by reading it, you've just needlessly destroyed your program's
 compatibility with a large portion of the Unix-y universe.  popen a
 mount or df, and information will be easier to extract portably.

On the other hand I know of at least two boxes (no, not mine) where
ordinary users don't have permission to exec mount.





   Florian
-- 
Emacs doesn't crash!  It contains very little C, so there's very
little reason to have it crash. [Pascal Bourguignon in gnu.emacs.help]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: detecting drives for windows and linux

2006-03-27 Thread Florian Diesch
[EMAIL PROTECTED] (Alex Martelli) wrote:

 Max [EMAIL PROTECTED] wrote:

 BWill wrote:
 
  oh, I wasn't expecting a single solution for both platforms, just some
  good solutions
  
  thanks
 
 Are you aware that this idea is somewhat foreign to Linux? (Maybe you
 are and want to do it anyway?) Linux puts the whole file system 
 (including mounted iPods, ISOs and NTFS drives) in one hierarchy.

 Yes, but you may still want to distinguish (because, for example, hard
 linking doesn't work across filesystems, and mv is not atomic then).

Why not use os.stat?


 Running a df command is a good simple way to find out what drives are
 mounted to what mountpoints -- the mount command is an alternative, but
 its output may be slightly harder to parse than df's.

Executing df may be expensive if it needs to read some slow file systems. 
Reading /etc/mtab is not difficult and much faster.


   Florian
-- 
Das toitsche Usenet ist die Wiederaufführung des Dreißigjährigen Krieges mit
den Mitteln einer Talkshow.  [Alexander Bartolich in dcpu]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UML from py sources

2006-03-24 Thread Florian Diesch
Ravi Teja [EMAIL PROTECTED] writes:

 Not to interrupt the valuable lesson with Google :-)
 Boa Constructor.

dia and dia2code


   Florian
-- 
Es gibt Leute, die von sich behaupten wenn ich Kaffee trinke, kann ich
nicht schlafen!. Bei mir ist das umgekehrt: Wenn ich schlafe, kann ich
keinen Kaffee trinken.  [Juergen Ilse in de.alt.folklore.urban-legends]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Type Hinting vs Type Checking and Preconditions

2006-03-10 Thread Florian Diesch
Tom Bradford [EMAIL PROTECTED] writes:

 Let me first say that I'm sure that this subject has come up before,
 and so forgive me for beating a dead horse.  Secondly, let me say that
 Python's strength is its dynamic nature, and I don't believe that it
 should ever require a precondition scaffolding. With that said, I do
 believe that something like type hinting would be beneficial to the
 Python community, both for tool enablement and for disambiguous
 programming.

 Here is what I mean.  The following function, though conventionally
 indicating that it will perform a multiplication, will yield standard
 Python behaviors if a string value is passed to it:

 def multiplyByTwo(value):
 return value * 2

 Passing 14 to it will return 28, whereas passing 14 to it will return
 1414.  Granted, we know and accept that this is Python's behavior
 when you multiply two values, but because we don't (and shouldn't have
 to) know the inner workings of a function, we don't know that the types
 of the values that we pass into it may adversly affect that results
 that it yields.

 Now, on the other hand, if we were to introduce a purely optional type
 hint to the function prototype, such as follows:

 def multiplyByTwo(value:int):
 return value * 2

 The python interpreter could do the work of casting the incoming
 parameter to an int (if it is not already) before it is multipled,
 resulting in the desired result or a typecasting error otherwise.
 Furthermore, it could do it more efficiently than a developer having to
 put conditional code at the beginning of traditionally typecasting
 functions.

What's the advantage? Instead of multiplication may not do what I want
with some classes you got casting to int may not do what I want
with some classes. 
Passing a float now returns a much more counterintuitive result than 
passing a string in the old function.
And it's not working anymore with classes which you can not cast to int 
but implement multiplication.

In any case you have to document what exactly your function is doing and
the user has to read this documentation.



   Florian
-- 
Emacs doesn't crash!  It contains very little C, so there's very
little reason to have it crash. [Pascal Bourguignon in gnu.emacs.help]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Printing a file

2006-03-03 Thread Florian Diesch
Fabian Steiner [EMAIL PROTECTED] wrote:
 I am currently working on an application where the user is able to 
 create new worksheets and to delete existing ones. All of these 
 worksheets have the same structure (-- template?), only some values 
 should be changed. A minimal example would be something like this:

 Name: ...
 Role: 
 Address: 

 The values are stored in a SQLite database. Now I would like to offer 
 the possibility to print out a single record on a DinA4 paper. In order 
 to do this, the dots (...) above of course have to be replaced by the 
 current record's values and the different parts have to fit on one page.

 Unfortunately I don't know how to realize this, since also some images 
 and different boxes should be printed out. As the whole application is 
 based on QT, QPrinter might be used, but I couldn't find any examples 
 how to use it.

 What do you suggest? Which format should the template have? (XML, etc.?)

I would either use something like ReportLab to create PDF or some
external type-setting language like LaTeX, *roff or docbook if they are
availabled.




   Florian
-- 
No no no! In maths things are usually named after Euler, or the first
person to discover them after Euler.
[Steven D'Aprano in [EMAIL PROTECTED]]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Too Many if Statements?

2006-02-09 Thread Florian Diesch
Alan Morgan [EMAIL PROTECTED] wrote:
 In article [EMAIL PROTECTED],
 Bryan Olson  [EMAIL PROTECTED] wrote:
Alan Morgan wrote:
 slogging_away wrote:
 
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32, and have a script that makes numerous checks
on text files, (configuration files), so discrepancies can be reported.
The script works fine but it appears that I may have hit a wall with
'if' statements.

 I generated files with 1, 25000, and 5 simple if statements and ran
 them.  1 was okay, 25000 gave a bizarre internal error, and 5 
 segfaulted
 and died.  My system has plenty of memory and it isn't obvious to me why 
 python
 should be so bothered about this.  I'm not sure why I can have 10x the 
 number of
 if statements that cause you trouble.  There might be some overall 
 limitation
 on the number of statements in a file.

I made a script with 100,000 if's, (code below) and it appears
to work on a couple systems, including Python 2.4.2 on Win32-XP.
So at first cut, it doesn't seem to be just the if-count that
triggers the bug.

 Mine was a simple

 #!/usr/local/bin/python

 zot=24999
 if zot == 0:
   print It's 0

 if zot == 1:
   print It's 1

 

 if zot == 24999:
   print It's 24999

 generated (I'm ashamed to admit) by a perl script.  Is there any good
 reason why it is failing?  I'd prefer a Too many silly walks in your
 program.  Reduce! to a crash.  I could experiment with putting the
 matching 'if' at the beginning rather than at the end, but I'm not
 sure what that would tell me.


Here[1] it works with 40 (with 50 it starts swapping too much) 
if-statements generated by

==
#!/usr/bin/env python

print #!/usr/bin/env python

zot=24999


for i in range(0, 40):
 print 
if zot == %d:
   print It's %d
 %(i,i)
 



[1] Python 2.4.2 (#2, Sep 30 2005, 21:19:01) 
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)]



   Florian
-- 
No no no! In maths things are usually named after Euler, or the first
person to discover them after Euler.
[Steven D'Aprano in [EMAIL PROTECTED]]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OS.MKDIR( ) Overwriting previous folder created...

2006-02-04 Thread Florian Diesch
Ernesto [EMAIL PROTECTED] wrote:
 NEVERMIND !  Here is the solution...

 # 
 if (os.path.isdir(C:\\MyNewFolder) == 0):
   os.mkdir(C:\\MyNewFolder)
 # -

Maybe some other process creates C:\\MyNewFolder between the call of
isdir and mkdir, or mkdir fails for some other reasons (e.g. no
permission), so you have to catch exceptions anyway. But then there's no
need for isdir.


   Florian
-- 
Das ist ja das positive am usenet: man erfährt oft Dinge, nach denen
gar nicht gefragt wurde.
[Konrad Wilhelm in [EMAIL PROTECTED]]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONDOCS

2006-01-09 Thread Florian Diesch
J. D. Leach [EMAIL PROTECTED] wrote:
 Peter Otten wrote:

 
 You are getting no match rather than the wrong one. Have you verified that
 a subdirectory
 
 /usr/share/doc/python-2.4/html/lib
 
 exists on your system? If not, the documentation may not be properly
 installed.

 I checked it Peter and rearranged the files in the python-2.4 directory
 every which way absent deleting them, all to no avail. Interestingly, the

Do
   strace -e trace=file -o /tmp/strace.log python -m pydoc 'if'
(or some other system call tracer that is available on your system) 
and check /tmp/strace.log for where python is looking for the doc files.
Here it's /usr/share/doc/python2.4-doc/html/ref/if.html


   Florian
-- 
Einen Troll zu füttern ist das gleiche als würde man einen Haufen
Hundescheisse sehen, absichtlich reinsteigen und sich dann beschweren.
(Christian Schneider in [EMAIL PROTECTED])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Rename files with numbers

2005-11-13 Thread Florian Diesch
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Ok, so the function simplifyed without loops:

 def renamer(folder, band):
   archive = #file to transform
   rest = archive[3:]
   print band +  -,rest.capitalize()


 obs: the file names came this way(with spaces or apostrophes) from the
 cd i imported.

Maybe you want to take a look at Jack
http://www.home.unix-ag.org/arne/jack/, a IMHO very nice CD ripper
written in Python.


   Florian
-- 
Einen Troll zu füttern ist das gleiche als würde man einen Haufen
Hundescheisse sehen, absichtlich reinsteigen und sich dann beschweren.
(Christian Schneider in [EMAIL PROTECTED])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to present Python's OO feature in design?

2005-11-12 Thread Florian Diesch
Ben Sizer [EMAIL PROTECTED] wrote:
 I don't know if there are any tools that convert UML to Python code,

dia2code http://dia2code.sourceforge.net


   Floriaa
-- 
Einen Troll zu füttern ist das gleiche als würde man einen Haufen
Hundescheisse sehen, absichtlich reinsteigen und sich dann beschweren.
(Christian Schneider in [EMAIL PROTECTED])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: graphical or flow charting design aid for python class development?

2005-09-01 Thread Florian Diesch
William Gill [EMAIL PROTECTED] wrote:
 Being somewhat new to Python, and having a tendency to over complicate 
 things in my class design, I was wondering if anyone can suggest a 
 simple graphical or flowcharting tool that they use to organize their 
 class and program  design?  Because of a 55 mph head-on accident a few 

For Linux/Unix there is dia http://www.gnome.org/projects/dia to make
a class diagram and dia2code http://dia2code.sourceforge.net to create
Python code from it.

Probably you can find some other UML tools that support Python.


 I have used editors for other languages that allow the view to expand 
 and collapse functions/methods (like message threads here on the board), 
 which help, but I haven't seen anything like this for python.

For questions like Is there an editor that supports..., Emacs is
about always an answer ;-) It has outline-mode for this.


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spreadsheet with Python scripting and database interface?

2005-08-11 Thread Florian Diesch
Wolfgang Keller [EMAIL PROTECTED] wrote:
 I'm looking for a spreadsheet application (MacOS X prefered, but
 Windows, Linux ar available as well) with support for Python scripting
 (third-party plug-ins are ok) and a database interface.

 Applications that I know of (that they exist) are:

 MS Excel
 Quattro
 Lotus
 OO Calc
 Gnumeric
 Kspread

 Which ones have I forgotten?

 Which ones have support for Python scripting?


Package: gnumeric-plugins-extra
Description: additional plugins for the GNOME spreadsheet
 Gnumeric ships with a number of plugins; this package contains those
 plugins that require additional packages above what the 'gnumeric' package
 needs.
 .
 This includes
  o The Perl plugin
  o The Python plugin
  o The Python plugin loader
  o Additional Python functions
  o The Gnome glossary
  o The gda (Gnome Database Access) plugin
  o The GNOME-DB plugin


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs skeletons

2005-07-27 Thread Florian Diesch
Michael Hoffman [EMAIL PROTECTED] wrote:
 Does anyone have any Emacs skeletons they find useful for Python? I 
 Googled a little but didn't find anything enticing. I already have a 
 script that sets up script/module templates, so those aren't all that 
 useful.

else-mode http://www.zipworld.com.au/~peterm seems to be nice after
you get used to it.


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPythin installation woes

2005-07-22 Thread Florian Diesch
linuxfreak [EMAIL PROTECTED] wrote:

 Sybren Stuvel wrote:
 linuxfreak enlightened us with:
  Turns out that  libstdc++.so.5 is needed but I checked and i see
  that libstdc++.so.6 is installed on my system.

 On my system (Ubuntu, based on Debian), I can have multiple versions
 of libstdc++ installed at the same time.

 Does anyone know if the same can be done in fedora distributions???

Of course it can. Read the Program Library HOWTO 
http://www.dwheeler.com/program-library or ask in a linux group.

   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OO design

2005-07-20 Thread Florian Diesch
chris [EMAIL PROTECTED] wrote:
 I've been scripting with python for a while now. Basically writing a few
 functions and running in the ipython shell. That's been very useful. But the
 more I do this the more I see that I'm doing more or less the same thing
 over and over again. So its feels like I need to get into class programming
 with all its attendant benefits. However my biggest problem is a conceptual
 one. I just can't get my head around defining suitable classes, how they
 aquire data and communicate with each other. I'm hoping some of you python
 lamas out there might be able to share some of your wisdom on the subject.

Just some thoughts about it:

 What I basically do is a lot of the following::

 1. get arbitrary numerical data (typically large data sets in columnar
 format or even via COM from other packages. I generally have to deal with
 one or more sets of X,Y data)

You may create a class for each data format that reads that data and
creates a set from it.

 2. manipulate the data (scaling, least squares fitting, means, peaks,
 add/subtract one XY set from another etc)

This methods may either manipulate youe set's data or create a new set
with the data

 3. plot data (original set, results of manipulation, scatterplot, histograms
 etc  - I use matplotlib)

I never useds matplotlib. Maybe it's usefull to have one or more classes
covering the functions you need.

 4. export data (print, csv, shelve)

Again have a class for each output format.


 I have no problem writing bits of functional code to do any of the above.
 But for the life of me I can't see how I can hook them altogether in an OO
 based framework that I can build and extend (with more data formats,
 manipulations, GUI etc).

 When I think about what I should do I end up with a class XY that has a
 method for everything I want to do eg.

 class XY:
   def read_file
   def scale_data
   def plot_data
   def shelve_data

 But somehow that doesn't feel right, especially when I expect the number of
 methods will grow and grow, which would make the class very unwieldy.

 Even if that was a legitimate option, I don't understand conceptualy how I
 would, for example, plot two different XY objects on the same graph or add
 them together point by point. How do two different XY objects communicate

Have a look at the IntervalSet module someone announced here some time
before to get some ideas.

 and how do you deal with the thing that they must have in common (the plot
 screen for example).

Create classes for this things. Then you may either pass XY to method of Thing
or the Thing to a method of XY.


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE

2005-07-20 Thread Florian Diesch
linuxfreak [EMAIL PROTECTED] wrote:
Got going with python...and i must say its a pretty cool language.
 Been using Xemacs to write me programs. But I want an IDE that would

I'm using GNU emacs

 give me auto-completion, 

Read the manual about tags and abbrevs
Emacs Language Sensitive Editor (ELSE) http://www.zipworld.com.au/~peterm
looks interesting too.

 online help 

python-mode has C-c C-h for py-help-at-point

 and the like... Tried SPE and
 Dr.Pyhton but the former crashes regulary and the latter is quite
 unweildy and does not have a great many features. I quite like the UML
 feature found in SPE but the damn thing crashes way too often. What are
 you guys using and what do you think is the best IDE...or should i
 stick with Xemacs/emacs???

I don't like specialized IDE's as I'm using different languages and
don't want to switch my editor for them.

   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replacing last comma in 'C1, C2, C3' with 'and' so that it reads 'C1, C2 and C3'

2005-07-13 Thread Florian Diesch
Ric Da Force [EMAIL PROTECTED] wrote:
 I have a string such as 'C1, C2, C3'.   Without assuming that each bit of 
 text is of fixed size, what is the easiest way to change this list so that 
 it reads:
 'C1, C2 and C3' regardless of the length of the string.

 import re
 data = the first bit, then the second, finally the third
 re.sub(r(.*),, r\1 and, data)
'the first bit, then the second and finally the third'
 


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: computer algebra packages

2005-07-11 Thread Florian Diesch
François Pinard [EMAIL PROTECTED] wrote:
   Mascyma is (trying to be) a user-friendly graphical frontend for
   the Computer Algebra System GNU MAXIMA.

 I was not successful googling for this one.  Would you have an URL handy?

 Oops, OK!  Found it at  http://cens.ioc.ee/~pearu/misc/maxima/  .


As I'm reading news offline I don't know what's on that page. The Ubuntu
Linux copyright file says the files are obtained from
http://mulk.dyndns.org/cgi-bin/viewcvs.cgi/trunk.tar.gz?root=Python-Mascyma
view=tar and you can find more information at
http://www.brummulk.de.vu/projects/mascyma/



   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: latex/bibtex python paper?

2005-07-07 Thread Florian Diesch
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Does anyone have a good template that I might use for writing a python
 paper in latex/bibtex?  I've got the paper mostly done, but am having
 issues with the references.  I am definitely not an expert at
 latex/bibtex.  Right now, I have references defined like this:

 @article{imp,
   title = {imp -- Access the import internals},
   journal = http://www.python.org/doc/current/lib/module-imp.html;,
   author = {Python Software Foundation},
   year = {2005}
 }

 When I cite these, I get something like this (Foundation[2005]).  Is
 anyone willing to offer up a tarball of a complete paper with sty and
 bst that would make for a nice python paper?

I would use

@Manual{imp,
  title ={imp -- Access the import internals},
  key =  {imp},
  organization = {Python Software Foundation},
  address =  {\url{http://www.python.org/doc/current/lib/module-imp.html}},
  year = 2005
}

You need hyperref for \url.
With \bibliographystyle{apalike} I get imp (2005), but that depends on what
you want your references look like. I think you better ask in a TeX group 
about that. 



   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New WYSIWYG Python IDE in the works

2005-06-19 Thread Florian Diesch
McBooCzech [EMAIL PROTECTED] wrote:
 sorry for bothering you with my comment. From my point of view, the
 situation on the IDE (GUI??) development field for Python is really
 strange. Just try to imagine the same situation around the Python.
 Plenty of different approaches, versions, philosophies etc. Why people
 they really know the ways how to develop really good, prime and
 functional SW (I mean different developers of IDEs) do not do it
 together as a team (like in Python)? 


Why are there so many programming languages and people do not just
concentrate on improving Fortran and Lisp?
Why are there so many text editors and people do not just concentrate
on improving vi and emacs?

Different people have different needs and different ideas on how things
should be done, so sometimes so want to have different software.


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to overcome automatic cyrillic-to-/hex convert

2005-06-12 Thread Florian Diesch
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 But when I enter some Bulgarian (actually cyrillic) text as a string,
 it
 seems that Python automatically converts it to '\x00..\x00 ' and once
 converted that way I can't get it back into its original look. The only
 way to get it right is using print :

 a = 'ÌÀÌÀ' # 'Mam' in Bulgarian
 print a
 'ÌÀÌÀ'

 but

 a
 '\xcc\xe0\xec\xe0'


Did you try the locale module?


   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: computer algebra packages

2005-06-09 Thread Florian Diesch
Rahul [EMAIL PROTECTED] wrote:
 Well is there an open source computer algebra system written in python
 or at least having a python interface?
 I know of 2 efforts: pythonica and pyginac...are there any others?


Probably this is usable for you (I never used any of them):


Package: mascyma
Description: A user-friendly frontend for MAXIMA
 Mascyma is (trying to be) a user-friendly graphical frontend for the Computer
 Algebra System GNU MAXIMA.  It is written in Python and provides two GUIs,
 one of which based on PyGTK, the other based on wxPython.


Package: maxima
Description: A fairly complete computer algebra system-- base system
 This system MAXIMA is a COMMON LISP implementation due to William F.
 Schelter, and is based on the original implementation of Macsyma at
 MIT, as distributed by the Department of Energy.  I now have
 permission from DOE to make derivative copies, and in particular to
 distribute it under the GNU public license.
 .
 This package contains the main executables and base system files.




   Florian
-- 
begin  signature_virus
 Hi! I'm a signature virus. Please copy me to your signature to help me spread.
end
-- 
http://mail.python.org/mailman/listinfo/python-list