I Need help from all the group participants

2007-08-20 Thread Boris Ozegovic
Hi, I am working on some system, and the communication will take place through the chatterbot which will be written in AIML (interpreter is written in Python). English is not my mother tongue, so I need huge favor: if all of you can write two sentences, so that I could have greater pattern base

Re: I Need help from all the group participants

2007-08-20 Thread Boris Ozegovic
[EMAIL PROTECTED] wrote: > The only sentence that comes to mind is: > > "I hope I never find myself in a hospital that uses your system." You are not funny. The system isn't for hospitals, it is for university purposes. -- Ne dajte da nas lažljivac Bandić truje: http://cnn.blog.hr/arhiva-2007

Re: I Need help from all the group participants

2007-08-20 Thread Boris Ozegovic
[EMAIL PROTECTED] wrote: > I would be happy to help but I don't have a clear understand of what > the poster needs. Suppose you want to find out what is someone's pulse/heart rate, you can ask question in many ways, syntaxically, but with same semantic. One way to find out someone's pulse is to

Re: I Need help from all the group participants

2007-08-20 Thread Boris Ozegovic
Jason wrote: > I wonder what John's pulse is? Display John's pulse. I need to know > John's pulse. How many beats per minute is John's heart going? > What's John's pulse rate? How fast is John's heart rate? How fast is > John's blood pumping? What is the rate of John's heart? What is the >

Re: I Need help from all the group participants

2007-08-21 Thread Boris Ozegovic
Aaron wrote: [...] > Good luck. Thanks a lot for your help. -- Ne dajte da nas lažljivac Bandić truje: http://cnn.blog.hr/arhiva-2007-06.html#1622776372 -- http://mail.python.org/mailman/listinfo/python-list

Re: List Comprehension Question: One to Many Mapping?

2007-08-24 Thread Boris Borcic
Paul Rubin wrote: > beginner <[EMAIL PROTECTED]> writes: >> For example, if I have x=[ [1,2], [3,4] ] >> >> What I want is a new list of list that has four sub-lists: >> >> [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] > > [[a, map(f,a)] for a in x] no, that one will be [[[1,2], [f(1), f(2)]], [[3,4

localhost, ?!

2007-08-28 Thread Boris Ozegovic
Three machines, one at my home, other two at my job, in every machine there is Win XP SP2 and Python 2.5 At home: urllib2.urlopen("http://localhost";), everything is ok At job: urllib2.urlopen("http://localhost";) raise BadStatusLine(line), after half a minute. urllib2.urlopen("http://127.0.0.1"

Re: localhost, ?!

2007-08-28 Thread Boris Ozegovic
Fabio Z Tessitore wrote: > I think to have http://localhost working you need a web server (like > apache). maybe you have it at your home. I do have Apache. You can see that urllib, older module, works correctly. -- http://mail.python.org/mailman/listinfo/python-list

Re: localhost, ?!

2007-08-28 Thread Boris Ozegovic
Bjoern Schliessmann wrote: > Definitely a problem with the web server (503 means "service > unavailable"). I did try on two servers, Apache and simple python server. There was identically error on both servers. >> Anybody have slightest clue wthat is going on? :-/ > > Try using wireshark or

Re: SOAP : ZSI error

2007-09-03 Thread Boris Borcic
linuxprog wrote: > hello i need some help with ZSI module > i want to use the web service located here > www.ebob42.com/cgi-bin/NumberToWordsInDutch.exe/soap/IDutch > the wsdl file : > http://www.ebob42.com/cgi-bin/NumberToWordsInDutch.exe/wsdl/IDutch > that web service is very simple , the funct

Re: So what exactly is a complex number?

2007-09-03 Thread Boris Borcic
Lamonte Harris wrote: > Like in math where you put letters that represent numbers for place > holders to try to find the answer type complex numbers? > Not quite. Relating them to (plane) trigonometry is much closer to the mark. Complex numbers are like a subclass of real numbers that elegantly

Re: So what exactly is a complex number?

2007-09-05 Thread Boris Borcic
Roy Smith wrote: > Boris Borcic <[EMAIL PROTECTED]> wrote: >> Complex numbers are like a subclass of real numbers > > I wouldn't use the term "subclass". Really you should name yourself as the author when you butcher someone else's prose to such

Re: So what exactly is a complex number?

2007-09-05 Thread Boris Borcic
Paul Rubin wrote: > Also, for > example, the derivative of a complex valued function means something > considerably stronger than the derivative of a real valued function. I vaguely remember (it has been decades) an amazingly beautiful russian doll system of four of five theorems, the first hypot

Re: How to calculate a file of equations in python

2007-03-21 Thread Boris Borcic
r='' for line in file : r = str(eval(r+line)) John wrote: > Hi, > I have a text file which contains math expression, like this > 134 > +234 > +234 > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > Can you please tell me what is the easiest way to calculate that file? >

Python data visualization

2007-04-11 Thread Boris Ozegovic
Hi I don't know if someone is familiar with Java JUNG, framework for data visualization (http://jung.sourceforge.net/), I am interested is there anything lik JUNG for Python? -- Greatest shits: http://www.net.hr/vijesti/page/2007/03/30/0030006.html -- http://mail.python.org/mailman/listinfo/p

int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread Boris Dušek
+= int(byte) * factor factor *= 2**8 Could you please tell me how to achieve what I want in Python? (it would be straightforward in C) Thanks for any suggestions, Boris Dušek -- http://mail.python.org/mailman/listinfo/python-list

Re: int('\x23') != 0x23 (a.k.a convert char to integer of its byte representation)

2007-09-15 Thread Boris Dušek
n. > Thanks Marc, both things are exactly what I was looking for (I am a bit ashamed that I did not find the built-in ord :-) Boris -- http://mail.python.org/mailman/listinfo/python-list

Function return a dictionary

2007-10-01 Thread Boris Mok
Hi all, I'm doing a function which needs return an arrary -- or more specially a dictionary data type. I have a sample like this def AFC(): v["a"] = 1 return v v = AFC() print v["a"] with error NameError: global name 'v' is not defined how do I go abou

Re: Need some help...

2007-10-30 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > I want to create a program that I type in a word. > > for example... > > chaos > > each letter equals a number > > A=1 > B=20 > > and so on. > > So Chaos would be > > C=13 H=4 A=1 O=7 S=5 > > I want to then have those numbers > 13+4+1+7+5 added together to be

Re: Iteration for Factorials

2007-10-30 Thread Boris Borcic
Py-Fun wrote: > I'm stuck trying to write a function that generates a factorial of a > number using iteration and not recursion. Any simple ideas would be > appreciated. > fact = lambda n : len(map([1].__imul__,range(1,n+1))[0]) hth :) BB -- http://mail.python.org/mailman/listinfo/python-list

Re: permuting over nested dicts?

2007-11-01 Thread Boris Borcic
Christian Meesters wrote: > Hoi, > > I have the following data structure (of variable size actually, to make > things simple, just that one): > d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, > 'b': {'x':[7,8,9], 'y':[10,11,12]}} > This can be read as a dict of possibilities: The entities 'a' and 'b' h

Re: Need some help...

2007-11-01 Thread Boris Borcic
Ricardo Aráoz wrote: > Boris Borcic wrote: >> [EMAIL PROTECTED] wrote: >>> I want to create a program that I type in a word. >>> >>> for example... >>> >>> chaos >>> >>> each letter equals a number >>> >>&g

Re: setting and getting column in numpymatrix

2007-11-01 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > hi > i am looking for an efficient way to get a specific column of a > numpy.matrix .. > also i want to set a column of the matrix with a given set of > values ..i couldn't find any methods for this in matrix doc..do i have > to write the functions from scratch? > >

Re: Need some help...

2007-11-02 Thread Boris Borcic
Ricardo Aráoz wrote: > Boris Borcic wrote: >> Ricardo Aráoz wrote: >>> Boris Borcic wrote: >>>> [EMAIL PROTECTED] wrote: >>>>> I want to create a program that I type in a word. >>>>> >>>>> for example... >>

Re: new style class

2007-11-02 Thread Boris Borcic
gert wrote: > Could not one of you just say "@staticmethod" for once damnit :) > I did, did I not ? -- http://mail.python.org/mailman/listinfo/python-list

Re: new style class

2007-11-02 Thread Boris Borcic
gert wrote: > class Test(object): > > def execute(self,v): > return v > > def escape(v): > return v > > if __name__ == '__main__': > gert = Test() > print gert.m1('1') > print Test.m2('2') > > Why doesn't this new style class work in python 2.5.1 ? > why s

Re: new style class

2007-11-02 Thread Boris Borcic
gert wrote: [...] Why doesn't this new style class work in python 2.5.1 ? >>> why should it ? >> I don't know I thought it was supported from 2.2? > > oops the code is like this but doesn't work > > class Test(object): > > def m1(self,v): > return v > > def m2(v): >

Re: Best way to document Python code...

2007-01-22 Thread Boris Ozegovic
Adonis Vargas wrote: > Then Python will generate a quick help interface for your module. I Hi Does Python has API just like in Java, for example http://java.sun.com/j2se/1.5.0/docs/api/allclasses-noframe.html ctrl-f and than click on class you are searching for, and finally you get clean list o

Rendering text question (context is MSWin UI Automation)

2007-01-23 Thread Boris Borcic
with Tkinter or otherwise - way to wrap access to the MS Windows UI text rendering engine, as a function that would return a picture of rendered text, given a string, a font, a size and colors ? And ideally, without interfering with screen contents ? Thanks in advance for any guidanc

Re: Rendering text question (context is MSWin UI Automation)

2007-01-24 Thread Boris Borcic
hat er, counts for me). I could probably manage such imprecisions but I would rather have an exact solution. ... > > I work with wxPython and Win32 applications exclusively. > > So if I can be of any help or assistance, please let me know. > > Geoff. > Thanks f

Re: Rendering text question (context is MSWin UI Automation)

2007-01-24 Thread Boris Borcic
Chris Mellon wrote: > On 1/23/07, Boris Borcic <[EMAIL PROTECTED]> wrote: >> ...A simple - >> with Tkinter or otherwise - way to wrap access to the MS Windows UI text >> rendering engine, as a function that would return a picture of rendered >> text, >

Re: Rendering text question (context is MSWin UI Automation)

2007-01-24 Thread Boris Borcic
this make sense ? Is it possible to position text with subpixel accuracy ? Regards, Boris Borcic -- http://mail.python.org/mailman/listinfo/python-list

Re: Rendering text question (context is MSWin UI Automation)

2007-01-25 Thread Boris Borcic
Chris Mellon wrote: > On 1/24/07, Boris Borcic <[EMAIL PROTECTED]> wrote: >> Chris Mellon wrote: >>> Using either win32 or wxPython you will be able to produce bitmaps >>> directly, without needing to create a visible window. >>> >>> >>>

Re: Rendering text question (context is MSWin UI Automation)

2007-01-25 Thread Boris Borcic
Chris Mellon wrote: > On 1/25/07, Boris Borcic <[EMAIL PROTECTED]> wrote: >> Chris Mellon wrote: >>>>> >>>>> Some quick & dirty wxPython code >>>>> >>>>> def getTextBitmap(text, font, fgcolor, bgcolor):

Re: Do I need Python to run Blender correctly?

2007-01-25 Thread Boris Borcic
years ago. YMMV, Boris Borcic -- http://mail.python.org/mailman/listinfo/python-list

Re: Module for SVG?

2007-01-25 Thread Boris . Boutillier
on to reduce dependencies. Boris On Jan 25, 10:58 am, "Sebastian Bassi" <[EMAIL PROTECTED]> wrote: > Hello, > > I foundhttp://www2.sfk.nl/svgas a Python module for writing SVG. > Last update was in 2004 and I am not sure if there is something > better. > Any recommendat

Re: Rendering text question (context is MSWin UI Automation)

2007-01-25 Thread Boris Borcic
Chris Mellon wrote: >> Maybe. In any case, color separation solves my (sub)problem : the blue layer >> from the wx generated model matches the green layer from the app's window, >> pixel >> for pixel (at least with antialiasing and cleartype on, while writing black >> on >> white). >> > > That's

Re: Sorting a list

2007-02-01 Thread Boris Ozegovic
John Salerno wrote: > Hi everyone. If I have a list of tuples, and each tuple is in the form: > > (year, text) as in ('1995', 'This is a citation.') > > How can I sort the list so that they are in chronological order L.sort() -- "kad imaš 7 godina glup si ko kurac, sve je predobro: autići i b

Re: Germany issues warrants for 13 American CIA agents

2007-02-02 Thread Boris Borcic
Vance P. Frickey wrote: > I understand that Mengele's old boss is still alive and well > in Deutschland What else do you understand ? -- http://mail.python.org/mailman/listinfo/python-list

Jython

2007-02-03 Thread Boris Ozegovic
Hi Why this doesn't work: def go(): for line in open("bobo.txt", "r"): print line go() python FileReader.py: everything ok jython FileReader.py: Traceback (innermost last): File "FileReader.py", line 6 File "FileReader.py", line 3 AttributeError: __getitem__ -- "A

Re: Jython

2007-02-03 Thread Boris Ozegovic
[EMAIL PROTECTED] wrote: > Files aren't lists and thus don't have the functions for iteration. They do have iterator: C:\Documents and Settings\Silovana Vjeverica\Desktop>python FileReader.py 'import site' failed; use -v for traceback boris ozegovic vedran ozegovi

Re: Jython

2007-02-03 Thread Boris Ozegovic
Boris Ozegovic wrote: > [EMAIL PROTECTED] wrote: > >> Files aren't lists and thus don't have the functions for iteration. > > They do have iterator: > > C:\Documents and Settings\Silovana Vjeverica\Desktop>python FileReader.py > 'import site&#

Re: Jython

2007-02-03 Thread Boris Ozegovic
you can do even this: import sys for line in sys.stdin: print line, python FileReader.py < bobo.tx 'import site' failed; use -v for traceback boris ozegovic vedran ozegovic -- "A mi smo stranci u vlastitoj zemlji zbog ljudskog sljama, lipa nasa silovana" -- http://mail.python.org/mailman/listinfo/python-list

Module problem

2007-02-06 Thread Boris Ozegovic
Hi I am writing some simple script, and when I start my script from command line (python Imenik.py), everything works perfectly. If I double clik the same script in my desktop I get the following error: "No module name import win32clipboard" -- "A mi smo stranci u vlastitoj zemlji zbog ljudsko

Re: Module problem

2007-02-06 Thread Boris Ozegovic
Matimus wrote: > Do you have more than one version of Python installed? Is > win32clipboard installed for both versions? It could be that the Yup, that was the problem. Thanx! -- "A mi smo stranci u vlastitoj zemlji zbog ljudskog sljama, lipa nasa silovana" -- http://mail.python.org/mailman/l

calling python from msc.adams

2007-02-07 Thread boris . smirnov
? Thank you very much. Regards, Boris -- http://mail.python.org/mailman/listinfo/python-list

Functions, parameters

2007-02-08 Thread Boris Ozegovic
Hi, I'am still learning Python and while reading Django tutorial couldn't understand this part: class Poll(models.Model): question = models.CharField(maxlength=200) pub_date = models.DateTimeField('date published') # Django provides a rich database lookup API that's entirely driv

Re: Functions, parameters

2007-02-08 Thread Boris Ozegovic
Bruno Desthuilliers wrote: > Why don't you just read the source code ? Django is free software, you > know !-) Yes, I know. :) > What about something like: > def filter(self, **kw): >for argname, value in kw.items(): > fieldname, op = argname.split('__', 1) Yes, this is what conf

Re: Functions, parameters

2007-02-08 Thread Boris Ozegovic
Paul Rubin wrote: > Since split is applied to argname, it retrieves 'question' and 'startswith'. Exactly. :) And, 'questions' and 'startswith' are two string, and not references at Poll.question, or more precisely, instanceOfPoll.question. I suppose this is what I was looking for: __getattri

Django, one more newbie question

2007-02-09 Thread Boris Ozegovic
Umm, can somebody tell me which language is this one: {% if latest_poll_list %} {% for poll in latest_poll_list %} {{ poll.question }} {% endfor %} {% else %} No polls are available. {% endif %} Whole tutorial is on this page: http://www.djangoproject.com/documentati

Module trouble [newbie]

2007-02-23 Thread Boris Ozegovic
Can somebody explaint this to me: I have module a.py A = 100 import b print "A printing" print "B is %s" % b.B and module b.py B = 2000 import a print "B printing" print "A is %s" % a.A I thought that output would be: B printing A is 100 A printing B is 2000 Because import b would execute b.py,

Re: Module trouble [newbie]

2007-02-23 Thread Boris Ozegovic
Diez B. Roggisch wrote: > Are you sure the above is what you really used for your test? Because your > output features a single 100, which the above lacks a print-statement for. Yeah, I cancelled the message, but synchronization allready happened. :) Problem was in some other place. One more q

Re: Module trouble [newbie]

2007-02-23 Thread Boris Ozegovic
Diez B. Roggisch wrote: > I use it sometimes myself, to avoid otherwise circular imports. Circular imports are the reason why I have module issues. Last question: if I put modules in some package and then try to import one I get "AttributeError: 'module' object has no attribute 'a' Code is: a

Interactive os.environ vs. os.environ in script

2007-02-26 Thread boris . smirnov
gt; import shrink_bs_070226 Traceback (most recent call last): File "", line 1, in ? File "shrink_bs_070226.py", line 25, in ? from qt import * ImportError: No module named qt >>> os.environ["LD_LIBRARY_PATH"]='/path/Linux/rh_linux' >&g

Re: Interactive os.environ vs. os.environ in script

2007-02-26 Thread boris . smirnov
]='/path/Linux/rh_linux' but this line didn't work. But when I set this environment variable in Linux shell it works. Here is a small example. > python shrink_bs_070226.py Traceback (most recent call last): File "shrink_bs_070226.py", line 25, in ? from qt import * File "/path/Linux/python/rh_linux/lib/python2.2/site-packages/ qt.py", line 46, in ? import libsip ImportError: libadamsqt.so: cannot open shared object file: No such file or directory > setenv LD_LIBRARY_PATH /path/Linux/rh_linux > python shrink_bs_070226.py Starting Script "Shrinker" Why it's not working in script with command os.environ["LD_LIBRARY_PATH"]='/path/Linux/rh_linux' but in shell it works? I hope it's understandable. :) Thanks, boris -- http://mail.python.org/mailman/listinfo/python-list

Re: Interactive os.environ vs. os.environ in script

2007-02-26 Thread boris . smirnov
and the problem still persists: Traceback (most recent call last): File "shrink_bs_070226.py", line 26, in ? from qt import * File "/path/Linux/python/rh_linux/lib/python2.2/site-packages/ qt.py", line 46, in ? import libsip ImportError: libadamsqt.so: cannot open shared object file: No such file or directory Is there another possibility of how to solve it just by adding some lines in script? Thanks Boris -- http://mail.python.org/mailman/listinfo/python-list

Re: Interactive os.environ vs. os.environ in script

2007-02-27 Thread boris . smirnov
ath/Linux/rh_linux' os.system("shrink_bs_070226.py") raise SystemExit from qt import * *** Is that correct. If yes then it not works. If not then, what's wrong? > python shrink_bs_070226.py Traceback (most recent call last): File "./shrink_bs_070226.py", line 29, in ? from qt import * ImportError: No module named qt Thanks Boris -- http://mail.python.org/mailman/listinfo/python-list

Re: Interactive os.environ vs. os.environ in script

2007-02-27 Thread boris . smirnov
On Feb 27, 10:33 am, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 27, 9:31 am, Peter Otten <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >> > Is there another possibility of how to solve it just by adding some > >> > lines in script? > > >> I think you h

QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread boris . smirnov
Hi all, I have a python script that works without any problem on Windows but with error: QPaintDevice: Must construct a QApplication before a QPaintDevice on Linux. Where could be the problem? Thanks. Boris -- http://mail.python.org/mailman/listinfo/python-list

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread boris . smirnov
On Feb 27, 11:46 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi all, > > > I have a python script that works without any problem on Windows but > > with error: > > > QPaintDevice: Must construct a QApplication before a QPaintDevice > > > on Linux. > > > Where co

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread boris . smirnov
On Feb 27, 11:56 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Yes that I can deduce, but why I'm asking is why it's different on > > Windows and Linux. Should it not be platform independent? > > It should be. I've got no idea why it seems to work on windows but I can say > one thing for su

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-27 Thread boris . smirnov
. I've tried today to read something for the beginners about traceback and stack trace in the forum, but I haven't found something really understadable for met. Some piece of code for my case will help :) and I want to learn it of course. Thanks. Boris -- http://mail.python.org/mailman/listinfo/python-list

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-28 Thread boris . smirnov
On Feb 28, 8:56 am, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Tuesday 27 February 2007 11:09 pm, shredwheat wrote: > > > When your programs stops with the error, it should also be printing a > > stack trace. This is a list of all the functions that have been called > > when Python had the probl

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-28 Thread boris . smirnov
On Feb 28, 9:07 am, [EMAIL PROTECTED] wrote: > On Feb 28, 8:56 am, Phil Thompson <[EMAIL PROTECTED]> > wrote: > > > On Tuesday 27 February 2007 11:09 pm, shredwheat wrote: > > > > When your programs stops with the error, it should also be printing a > > > stack trace. This is a list of all the func

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-28 Thread boris . smirnov
On Feb 28, 10:22 am, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Wednesday 28 February 2007 9:00 am, [EMAIL PROTECTED] wrote: > > > > > > > On Feb 28, 9:07 am, [EMAIL PROTECTED] wrote: > > > On Feb 28, 8:56 am, Phil Thompson <[EMAIL PROTECTED]> > > > > wrote: > > > > On Tuesday 27 February 2007 1

Re: QPaintDevice: Must construct a QApplication before a QPaintDevice

2007-02-28 Thread boris . smirnov
On Feb 28, 10:45 am, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Wednesday 28 February 2007 9:26 am, [EMAIL PROTECTED] wrote: > > > > > > > On Feb 28, 10:22 am, Phil Thompson <[EMAIL PROTECTED]> > > > wrote: > > > On Wednesday 28 February 2007 9:00 am, [EMAIL PROTECTED] wrote: > > > > On Feb 28,

Re: How to use list as key of dictionary?

2007-11-05 Thread Boris Borcic
Davy wrote: > Hi all, > > We know that list cannot be used as key of dictionary. Yeah, but do we know why ? > So, how to work > around it? That's a subsidiary question. > > For example, there is random list like l=[1,323,54,67]. Don't use 1owercase L as a variab1e name, p1ease ! > > Any su

Re: How to use list as key of dictionary?

2007-11-06 Thread Boris Borcic
st regards, > Davy > > On Nov 6, 4:50 pm, Davy <[EMAIL PROTECTED]> wrote: >> Hi Matimus and Boris, >> >> Thank you :) >> >> And a further question about vector above rank 1, how can I use it as >> the key of dictionary? >> >> For e

Re: List to Tuple and Tuple to List?

2007-11-06 Thread Boris Borcic
Davy wrote: > Hi all, > > I am curious about whether there is function to fransform pure List to > pure Tuple and pure Tuple to pure List? > > For example, > > I have list L = [[1,2,3],[4,5,6]] > something list2tuple() will have T=list2tuple(L)=((1,2,3),(4,5,6)) > > And the tuple2list() > > An

Re: Trouble with for loop

2007-11-06 Thread Boris Borcic
Shriphani wrote: > On Nov 6, 3:09 pm, Ant <[EMAIL PROTECTED]> wrote: >> On Nov 6, 9:59 am, Shriphani <[EMAIL PROTECTED]> wrote: >> ... >> >>> My main intention is to state that each of the variables namely a, b, >>> c, ## can take value from 1 to 9. >>> How do I go about this ? >> It sounds like yo

Re: What about a Python Tree container?

2007-11-06 Thread Boris Borcic
Roc Zhou wrote: > Hello, Hello, This post is too long. The right place for such is as a python reciepe on ActiveState. BTW, I bet you can find 3+ equivalents to you Tree type in the recorded reciepes. Regards, BB -- http://mail.python.org/mailman/listinfo/python-list

Re: permuting over nested dicts?

2007-11-08 Thread Boris Borcic
Boris Borcic wrote: > Christian Meesters wrote: >> Hoi, >> >> I have the following data structure (of variable size actually, to make >> things simple, just that one): >> d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, >>

Re: How to link different site-packages to different Python?

2007-11-09 Thread Boris Borcic
Davy wrote: > Hi all, > > I have Python 2.4 and 2.5 in my PC. And PythonWin is installed as IDE. > > When I tried to use site-packages "Numpy", I installed the both > version (i.e. for 2.4 and 2.5). > > Python 2.4 and Numpy for it work together well. > > But when I type "from numpy import *" in

Re: Closure/binding problem or misunderstanding

2007-11-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > If I run the following code: > > class path(object): > def __init__(self, **subdirs): > for name, path in subdirs.iteritems(): > def getpath(): > return path > setattr(self, name, getpath) > > export = path( > one

Re: Using python as primary language

2007-11-09 Thread Boris Borcic
Michel Albert wrote: > > What I meant was that one should be able to "draw" a report template. > Basically a graphical user interface for RML in this case. I > personally would opt for writing RML or whatever code myself. But it's > impossible to convice my boss. The dialog usually goes like this:

Re: implement random selection in Python

2007-11-16 Thread Boris Borcic
Bruza wrote: > No. That does not solve the problem. What I want is a function > > def randomPick(n, the_items): > > which will return n DISTINCT items from "the_items" such that > the n items returned are according to their probabilities specified > in the (item, pro) elements inside "the_items

Re: implement random selection in Python

2007-11-16 Thread Boris Borcic
Bruza wrote: > No. That does not solve the problem. What I want is a function > > def randomPick(n, the_items): > > which will return n DISTINCT items from "the_items" such that > the n items returned are according to their probabilities specified > in the (item, pro) elements inside "the_items

Re: sorting contacts alphabetically, sorted by surname

2007-11-16 Thread Boris Borcic
Marie Hughes wrote: > HI > > I have to write a program that contains a text file in the following format: > > AcademicPositionRoom Ext. Email > Prof Marie Maguire Head of > School M9002 [EMAIL PROTECTED] > > > And

Re: sorting contacts alphabetically, sorted by surname

2007-11-16 Thread Boris Borcic
Wow J. Clifford Dyer wrote: > On Fri, Nov 16, 2007 at 12:31:19PM +, Marie Hughes wrote regarding > sorting contacts alphabetically, sorted by surname: >>HI >> >>I have to write a program that contains a text file in the following >>format: >> >>AcademicPosition

Re: implement random selection in Python

2007-11-16 Thread Boris Borcic
Boris Borcic wrote: > Bruza wrote: >> No. That does not solve the problem. What I want is a function >> >> def randomPick(n, the_items): >> >> which will return n DISTINCT items from "the_items" such that >> the n items returned are according to t

Re: Finding lowest value in dictionary of objects, how?

2007-11-19 Thread Boris Borcic
davenet wrote: > Hi, > > I'm new to Python and working on a school assignment. > > I have setup a dictionary where the keys point to an object. Each > object has two member variables. I need to find the smallest value > contained in this group of objects. > > The objects are defined as follows:

Re: eof

2007-11-22 Thread Boris Borcic
Duncan Booth wrote: > import itertools > def chunks(f, size): > iterator = iter(f) > def onechunk(line): > yield line > for line in itertools.islice(iterator, size-1): > yield line > for line in iterator: > yield onechunk(line) Quite simpler, and pro

Re: eof

2007-11-22 Thread Boris Borcic
> def chunked(chunksize,f) : > from itertools import count,groupby > counter=count(chunksize).next > return groupby(f,lambda _ : counter()/chunksize) And more to the point, no "yield" for Alexy to mock :) -- http://mail.python.org/mailman/listinfo/python-list

Re: eof

2007-11-22 Thread Boris Borcic
Duncan Booth wrote: > Nice, thank you. Welcome. > But why 'count(chunksize)' rather than just 'count()'? To number the first chunk 1, etc. using count() starts with 0. Matter of taste. > Does it make a difference anywhere? And I'd recommend using // rather than > / otherwise it breaks if you

Re: eof

2007-11-26 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > def xor(a, b): > return a and not b or b and not a >>> from operator import xor >>> help(xor) Help on built-in function xor in module operator: xor(...) xor(a, b) -- Same as a ^ b. -- http://mail.python.org/mailman/listinfo/python-list

Re: eof

2007-11-26 Thread Boris Borcic
ZeD wrote: > Grant Edwards wrote: > >> The user-defined xor is operates on "logical" boolean values. >> The one in the operator module is a bitwise operator. > > def xor(a, b): > return bool(a) ^ bool(b) > > seems more explicit to me. > maybe, to make "more" explicit (too much, onestly...) >

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread Boris Borcic
lisong wrote: > Hi All, > > I have problem to split a string like this: > > 'abc.defg.hij.klmnop' > > and I want to get all substrings with only one '.' in mid. so the > output I expect is : > > 'abc.defg', 'defg.hij', 'hij.klmnop' > > a simple regular expression '\w+.\w' will only return: > '

Re: "Python" is not a good name, should rename to "Athon"

2007-12-05 Thread Boris Borcic
Russ P. wrote: > If I had invented Python, I would have called it Newton or Euler, > arguably the greatest scientist and mathematician ever, respectively. This makes your taste on the matter dubious. Such choice of a name implies either a claim to the fame of the Person that's devoid of substanc

Re: "Python" is not a good name, should rename to "Athon"

2007-12-05 Thread Boris Borcic
Russ P. wrote: > Speaking of stupid names, what does "C++" mean? According to Special Relativity, C++ is a contradiction in terms :) -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-06 Thread Boris Borcic
Piet van Oostrum wrote: >> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote: > >> AC> For that matter C# is no better, I thought that # was pronounced >> AC> hash, I still refer to C# as C-hash. > > Are you musically illiterate? Note that the notation for the note (!) isn't universal. French

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Boris Borcic
Dirk Hagemann wrote: > (3566839/24)/365 = 407 - YES I did this calculation too and was > surprised. But if you try this out in MS Excel: > ="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put > 3566839 in field A1 and switch the format of the result-fieldby right- > click on it to

Re: .NET and Python Integration Problem and PDF Library (Need Help and Suggestions)

2007-12-18 Thread Boris Borcic
Ravi Kumar wrote: > - your opinion with available PDF Libraries, that are best among. Also > which library to use for Windows server platform (there is limitation > on installing long chain libraries that include other deep > dependencies too). A pure python PDF library would be good, but which > o

Re: Distinguishing attributes and methods

2007-12-19 Thread Boris Borcic
MonkeeSage wrote: > what am I missing? To my eyes, when you write: >I think it muddies the water to say that a.a() and a.a are the same >thing--obviously they are not. In the common case, the first is a >method, and the second is a variable. What you are most obviously missing is what's shown

Re: convert pdf to png

2007-12-26 Thread Boris Borcic
Carl K wrote: > Rob Wolfe wrote: >> Carl K <[EMAIL PROTECTED]> writes: >> >>> I need to take the take the pdf output from reportlab and create a >>> preview image for a web page. so png or something. I am sure >>> ghostscript will be involved. I am guessing PIL or ImageMagic ? >>> >>> all sugesti

genexp reduce syntax in 2.5a1

2006-04-18 Thread Boris Borcic
On the python3000 mailing list there was some discussion of a "comprehension syntax" for reduce. This inspired me the following proof-of-concept in pure python 2.5a1, although I don't know if it relies on an intended feature or a(n unintended) bug. Cheers, BB -- def ireduce(gen) : """

Re: what has python added to programming languages? (lets be esoteric, shall we ;)

2006-04-24 Thread Boris Borcic
Wildemar Wildenburger wrote: > Over the time I've seen lots of remarks about python that read like "a > lot like lists in lisp" or "like the hashtable in java" or any other > form of "like in ". > > Are there any concepts that python has not borrowed, Esoterically speaking, you should better d

Re: Pyrex installation on windows XP: step-by-step guide

2006-04-26 Thread Boris Borcic
Julien Fiore wrote: > Do you wand to install Pyrex on Windows ? > > Here is a step-by-step guide explaining: > > A) how to install Pyrex on Windows XP. > B) how to compile a Pyrex module. > > Julien Fiore, > U. of Geneva Thanks. One detail missing : for this (step b3) to work smooth

Re: set partitioning

2006-05-02 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > For the list [1,2,3,4], I'm looking for the following for k = 2: > > [[1,2], [3,4]] > [[1,3], [2,4]] > [[1,4], [2,3]] > > for k = 3: > > [[1,2,3], [4]] > [[1,2,4], [3]] > [[1,3,4], [2]] > [[2,3,4], [1]] > def pickk(k,N,m=0) : if k==1 : return ((n,) for

Re: set partitioning

2006-05-02 Thread Boris Borcic
I wrote: > > def pickk(k,N,m=0) : > if k==1 : > return ((n,) for n in range(m,N)) > else : > return ((n,)+more for more in pickk(k-1,N,m+1) > for n in range(m,more[0])) > > def partitionN(k,N) : > subsets = [frozenset(S) for S in pickk(k,N)]

Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
John Salerno wrote: > Is there a way to assign multiple variables to the same value, but so > that an identity test still evaluates to False? > > e.g.: > > >>> w = x = y = z = False > >>> w > False > >>> x > False > >>> w == x > True > >>> w is x > True # not sure if this is harmful

<    1   2   3   >