Implementing an 8 bit fixed point register

2008-07-01 Thread nickooooola
Hello to all I'm about to write a simulator for a microcontroller in python (why python? because I love it!!!) but I have a problem. The registry of this processor are all 8 bit long (and 10 bit for some other strange register) and I need to simulate the fixed point behaviour of the register, and

Re: Are the following supported in scipy.sparse

2008-07-01 Thread Matt Nordhoff
dingo_1980 wrote: > I wanted to know if scipy.sparse support or will support the following > functions which are available in scipy.linalg or scipy or numpy: > > Inverse > Cholesky > SVD > multiply > power > append > eig > concatenate > > Thanks... You should probably ask on a SciPy mailing list

how to judge urllib.Request is finished?

2008-07-01 Thread oyster
currently I am using [code] req=urllib2.Request(url) data='' if '' not in data: fd=urllib2.urlopen(req) data=fd.read() time.sleep(10) time.sleep(10) blahblah [/code] Is there any other ready-to-use function? And what if the internet connection is chocked so that the html pa

Re: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread A.T.Hofkamp
On 2008-07-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm looking over the docs for the re module and can't find how to > "NOT" an entire regex. (?! R) > How make regex that means "contains regex#1 but NOT regex#2" ? (\1|(?!\2)) should do what you want. Albert -- http://mail.python.org

Re: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Paul McGuire
On Jul 1, 2:34 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-07-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I'm looking over the docs for the re module and can't find how to > > "NOT" an entire regex. > > (?! R) > > > How make regex that means "contains regex#1 but NOT regex#2"

Re: how to judge urllib.Request is finished?

2008-07-01 Thread Marc 'BlackJack' Rintsch
On Tue, 01 Jul 2008 15:16:03 +0800, oyster wrote: > currently I am using > [code] > req=urllib2.Request(url) > data='' > if '' not in data: > fd=urllib2.urlopen(req) > data=fd.read() > time.sleep(10) > time.sleep(10) > blahblah > [/code] That looks very strange. Why the `

Re: Freeze problem with Regular Expression

2008-07-01 Thread Kirk
On Mon, 30 Jun 2008 13:43:22 -0700, John Machin wrote: >> I reply here to all of you about such point: that's not important, >> although I appreciate very much your suggestions! My point was >> 'something that works in Perl, has problems in Python'. > > It *is* important; our point was 'you didn'

Embedding Python

2008-07-01 Thread Marcin Krol
Hello everyone, I'm trying to embed Python interpreter in C code, but in a specific way: loading compiled bytecode into a memory location and executing it (don't ask why, complicated reasons). PyImport_ExecCodeModule seems like obvious candidate, docs say: "Given a module name (possibly of the

Re: Functions associated with a class.

2008-07-01 Thread Bruno Desthuilliers
Kurda Yon a écrit : Hi, I start to learn the object oriented programing in Python. As far as I understood, every class has a set of corresponding methods and variables. Every object has a set of attributes. Some of these attributes are methods (which are thmeselves objects too), some are not.

Having problems using Tkinter

2008-07-01 Thread viv1tyagi
Hi everyone ! ! ! I'm just a month old in the world of Python and trying to develop an application using Tkinter in which a new window pops out on a particular button press.The code for this new window is in "AddKlas.py" file. The problem is all the content of the new window is overwritten on th

Naruto 407, One Piece 506, Bleach 329 Hot manga Download

2008-07-01 Thread mangaboy001
Naruto 407, One Piece 506, Bleach 329 Hot manga Download The hottest mangas and the latest chapters Manga news, Most popular mangas, Latest mangas, Latest chapters http://english1.isoshu.com/?recommid=1023 http://emanga1.isoshu.com/?recommid=1023 A New Wonderful Manga: Maken-ki! http://englis

Re: PyPy questions

2008-07-01 Thread Dave
On 1 Jul, 04:09, Allen <[EMAIL PROTECTED]> wrote: > I read the website of some information about PyPy, and how a translator > translates the RPython code to C/CLI/Java/etc to be compiled to a native > executable or something like that.  Would it be possible, in PyPy, to > write such an extension th

Create a sex site

2008-07-01 Thread jinole
Asian porn sites! Not the best, only better. To join our team, we do together.URL: http://www.loioi.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Having problems using Tkinter

2008-07-01 Thread Marc 'BlackJack' Rintsch
On Tue, 01 Jul 2008 03:13:42 -0700, viv1tyagi wrote: > Hi everyone ! ! ! > > I'm just a month old in the world of Python and trying to develop an > application using Tkinter in which a new window pops out on a > particular button press.The code for this new window is in > "AddKlas.py" file. > The

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread moogyd
On 1 Jul, 08:57, nickola <[EMAIL PROTECTED]> wrote: > Hello to all > I'm about to write a simulator for a microcontroller in python > (why python? because I love it!!!) > > but I have a problem. > > The registry of this processor are all 8 bit long (and 10 bit for some > other strange register)

problem with exec and locals()

2008-07-01 Thread rocksportrocker
Hi, the following code does not work until I ommit the "a=0" statement. def test(): exec "a=3" in locals() print a a=0 test() print raises: UnboundLocalError: local variable 'a' referenced before assignment Can anybody explain what is going wrong here ? Gree

Re: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Vlastimil Brom
2008/7/1, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > I'm looking over the docs for the re module and can't find how to > "NOT" an entire regex. > > For example. > > How make regex that means "contains regex#1 but NOT regex#2" ? > > Chris > > -- > http://mail.python.org/mailman/listinfo/python-l

Disabling the magic "last expression" _ variable

2008-07-01 Thread Koen Vossen
A project I'm currently working on uses Turbogears as a framework. I'd like to interact with it using the tg-admin shell. We also use gettext's _() function for internationalization. Now, this function is overwritten in interactive mode, which causes annoying exceptions. Is it possible to disab

Re: Disabling the magic "last expression" _ variable

2008-07-01 Thread Peter Otten
Koen Vossen wrote: > A project I'm currently working on uses Turbogears as a framework. I'd > like to interact with it using the tg-admin shell. We also use gettext's > _() function for internationalization. Now, this function is overwritten > in interactive mode, which causes annoying exceptions.

Re: Disabling the magic "last expression" _ variable

2008-07-01 Thread Peter Otten
Koen Vossen wrote: > A project I'm currently working on uses Turbogears as a framework. I'd > like to interact with it using the tg-admin shell. We also use gettext's > _() function for internationalization. Now, this function is overwritten > in interactive mode, which causes annoying exceptions.

Scope and program structure problems

2008-07-01 Thread John Dann
Trying to learn Python here, but getting tangled up with variable scope across functions, modules etc and associated problems. Can anyone advise please? Learning project is a GUI-based (wxPython) Python program that needs to access external data across a serial port. The first thing that I need

wrong md5 checksum

2008-07-01 Thread kkwweett
Hi, the download page (http://www.python.org/download/releases/3.0/) for Python 3000 shows : 9119625244b17aa35ed94b655a2b2135 13491200 python-3.0b1.msi but I got 9119625244a57aa35ed94b655a2b2135 13491200 python-3.0b1.msi (44a57 rather than 44b17 ) with several md5 checkers ( MdChecker

Re: Why is recursion so slow?

2008-07-01 Thread Antoon Pardon
On 2008-06-29, slix <[EMAIL PROTECTED]> wrote: > Recursion is awesome for writing some functions, like searching trees > etc but wow how can it be THAT much slower for computing fibonacci- > numbers? Try the following recursive function: def fib(n): def gfib(a, b , n): if n == 0: ret

Re: perl + python tutorial available for download

2008-07-01 Thread Ben Bullock
On Mon, 30 Jun 2008 17:44:13 +, Jürgen Exner wrote: > Xah <[EMAIL PROTECTED]> wrote: >>my perl and python tutorial >> >>http://xahlee.org/perl-python/index.html >> >>is now available for download for offline reading. > > Why anyone would have the idea to mix two different langauges in one >

Re: PyPy questions

2008-07-01 Thread Stephan Diehl
Allen schrieb: > I read the website of some information about PyPy, and how a translator > translates the RPython code to C/CLI/Java/etc to be compiled to a native > executable or something like that. Would it be possible, in PyPy, to > write such an extension that could easily be compiled to nati

Re: Scope and program structure problems

2008-07-01 Thread Bruno Desthuilliers
John Dann a écrit : Trying to learn Python here, but getting tangled up with variable scope across functions, modules etc and associated problems. Can anyone advise please? Learning project is a GUI-based (wxPython) Python program that needs to access external data across a serial port. The f

Re: Embedding Python

2008-07-01 Thread Pau Freixes
Hi If PyImport_ExecCodeModule have a two parameteres and second parameter is PyObject type why you are make a call with a unsigned char value ? If you search this function name into Google you will can found some examples, use for example PyMarshal_ReadObjectFromString or PyMarshal_ReadObjectFro

Re: raw_input into Tkinter ?

2008-07-01 Thread Python.Arno
On 30 jun 2008, at 18:55, [EMAIL PROTECTED] wrote: Is there any way to type into a Tkinter frame window? I want to use raw_input() within a Tkinter frame. -- http://mail.python.org/mailman/listinfo/python-list You could use the Tkinter.Entry option from dialog windows... http://www.pythonwa

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread Mel
nickola wrote: > Hello to all > I'm about to write a simulator for a microcontroller in python > (why python? because I love it!!!) [...] > The registry of this processor are all 8 bit long (and 10 bit for some > other strange register) > and I need to simulate the fixed point behaviour of the

pyparsing problem

2008-07-01 Thread name
Hi, I try to parse a file with pyparsing and get this output: ['generic', 'host-01', 'host alias xyz', '10.0.0.1'] - alias: host alias xyz - host_name: ['host-01'] - ip_address: ['10.0.0.1'] - use: ['generic'] generic host-01 host alias xyz

recursive import

2008-07-01 Thread oj
Hi, I'm just toying around with some ideas at the moment. Is there an easy and safe way to recursivly import all modules under a particular namespace? Say, I had modules: foo foo.bar foo.bar.baz foo.baz bar bar.baz I want to import all the modules in the foo namespace, so the first four modules

Re: [Employment] New TurboGears Job in Eugene, OR

2008-07-01 Thread Aahz
In article <[EMAIL PROTECTED]>, Tim Roberts <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Aahz) wrote: >>Paul McNett <[EMAIL PROTECTED]> wrote: >>> >>>They want an expert for a maximum of $25 per hour? If they find someone, >>>it'll be a pretty good bullshitter looking for experience. >> >>Note

Re: problem with exec and locals()

2008-07-01 Thread Mel
rocksportrocker wrote: > > Hi, > > the following code does not work until I ommit the "a=0" statement. > > >def test(): >exec "a=3" in locals() >print a >a=0 > > test() > > print raises: > UnboundLocalError: local variable 'a' referenced before > assignme

Re: C++ or Python

2008-07-01 Thread Maria R
On Jun 28, 12:22 am, Kurda Yon <[EMAIL PROTECTED]> wrote: > I would like to know what are advantages of Python in comparison with C > ++? In which cases and why Python can be a better tool than C++? > > Thank you! Back in 2002, we made a hard decision between c++ (well established here) java (not

connecting to DBMS

2008-07-01 Thread varun chadha
i am a newbie to python and is working on an application which needs to connect to the database. can anyone guide me through the DBMS that i can use and the module to connect to it. currently i have MySQL installed using the link on the python.org site but is unable to connect to it through python.

Re: Embedding Python

2008-07-01 Thread Carsten Haese
Marcin Krol wrote: Hello everyone, I'm trying to embed Python interpreter in C code, but in a specific way: loading compiled bytecode into a memory location and executing it (don't ask why, complicated reasons). PyImport_ExecCodeModule seems like obvious candidate, docs say: "Given a module na

Re: Looping-related Memory Leak

2008-07-01 Thread Tom Davis
On Jun 30, 3:12 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 30 Jun 2008 10:55:00 -0700, Tom Davis wrote: > > To me, this seems illogical. I can understand that the GC is > > reluctant to reclaim objects that have many connections to other > > objects and so forth, but once th

Re: Scope and program structure problems

2008-07-01 Thread John Dann
Many thanks for the repsonse - much appreciated. And sorry - yes I was probably compounding two separate issues here - the GUI one and the variable scope one. Maybe the wxPython list would be the best place to ask more about the GUI side of things. Then actually I can simplify my remaining quest

Re: Looping-related Memory Leak

2008-07-01 Thread Tom Davis
On Jun 30, 8:24 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 30, 1:55 pm, Tom Davis <[EMAIL PROTECTED]> wrote: > > > > > On Jun 26, 5:38 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > On Jun 26, 5:19 am, Tom Davis <[EMAIL PROTECTED]> wrote: > > > > > I am having a problem where a long-runn

RE: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, July 01, 2008 2:29 AM > To: python-list@python.org > Subject: How make regex that means "contains regex#1 but NOT regex#2" > ?? > > I'm looking over the do

Re: pyparsing problem

2008-07-01 Thread Paul McGuire
On Jul 1, 8:02 am, name <[EMAIL PROTECTED]> wrote: > Hi, > > I try to parse a file with pyparsing and get this output: > >     ['generic', 'host-01', 'host alias xyz', '10.0.0.1'] >     - alias: host alias xyz >     - host_name: ['host-01'] >     - ip_address: ['10.0.0.1'] >     - use: ['generic']

Re: frame grabber hardware

2008-07-01 Thread rubbishemail
> Do you mean something like this? > > Easy Cap Audio-Video Capturing Adapter > http://www.youtube.com/watch?v=3AvT8JQ7NzI this would be suitable, if it had a documented driver, some sites said it could only be used with the included software. many bad comments, though: http://forums.ebay.com/db

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread Grant Edwards
On 2008-07-01, nickola <[EMAIL PROTECTED]> wrote: > Hello to all > I'm about to write a simulator for a microcontroller in python > (why python? because I love it!!!) > > but I have a problem. > > The registry of this processor are all 8 bit long (and 10 bit > for some other strange register) a

Installing paramiko and pycrypto

2008-07-01 Thread cokofreedom
I am really stuck presently, trying to install these on my Windows XP. I have downloaded easy_install and it is now in Python25\Scripts but none of the commands I have read in either program folder have worked to install them. I was hoping someone could give me a step by step guide to installing t

Re: Disabling the magic "last expression" _ variable

2008-07-01 Thread Ben Finney
Peter Otten <[EMAIL PROTECTED]> writes: > >>> import sys > >>> def displayhook(result): > ... if result is not None: > ... __builtins__._last = result > ... print result > ... Better is to explicitly import the name '__builtin__' http://www.python.org/doc/lib/module-bu

Re: pyparsing problem

2008-07-01 Thread name
Paul McGuire <[EMAIL PROTECTED]> wrote in news:be7af822-70d7-44fb-96fa- [EMAIL PROTECTED]: > > Looks like this is a bug in asXML(). Note that if I reverse the use > and host_name strings in the input and in your grammar, I get this XML > output: > > > host-01 > generic > host alias xyz >

RE: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Reedick, Andrew > Sent: Tuesday, July 01, 2008 10:07 AM > To: [EMAIL PROTECTED]; python-list@python.org > Subject: RE: How make regex that means "contains regex#1 but NOT > regex#2" ??

dynamically load from module import xxx

2008-07-01 Thread Neal Becker
What is a good way to emulate: from module import xxx where 'module' is a dynamically generated string? __import__ ('modulename', fromlist=['xxx']) seems to be what I want, but then it seems 'xxx' is not placed in globals() (which makes me wonder, what exactly did fromlist do?) -- http://mail.p

Re: Scope and program structure problems

2008-07-01 Thread Bruno Desthuilliers
John Dann a écrit : Many thanks for the repsonse - much appreciated. And sorry - yes I was probably compounding two separate issues here - the GUI one and the variable scope one. Maybe the wxPython list would be the best place to ask more about the GUI side of things. Then actually I can simpl

Re: dynamically load from module import xxx

2008-07-01 Thread Guilherme Polo
On Tue, Jul 1, 2008 at 12:11 PM, Neal Becker <[EMAIL PROTECTED]> wrote: > What is a good way to emulate: > > from module import xxx > where 'module' is a dynamically generated string? > > __import__ ('modulename', fromlist=['xxx']) > > seems to be what I want, but then it seems 'xxx' is not placed

How to use gnu readline library in program?

2008-07-01 Thread Grant Edwards
I'm trying to figure out how to use the gnu readline library so that when my program is prompting the user for input there is line editing and history support. I've read and re-read the documentation for the "readline" module in the standard library and I still can't figure out how to use the modu

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread nickooooola
Thanks to all for the responses! to MEl: I also want to build a pic simulator, but I want to do this as "python for big project" learning exercise, I have used python in the past only for small script and now I want to use it for something more "big". do you have some code to share? myhdl seems i

Re: How do web templates separate content and logic?

2008-07-01 Thread Kirk Strauser
At 2008-06-30T19:34:53Z, Mike <[EMAIL PROTECTED]> writes: > I should have say "why embedding HTML into Python is not good enough?" ;=) I'm a programmer and would be able to cope with embedding HTML in assembler if the need arose. Having said that, embedding HTML in anything but HTML tends to be

Error from zipfile

2008-07-01 Thread Wesley Brooks
Dear Users, I'm having a problem when trying to move script from Linux to Windows. A zipfile opperation is failing with the message: "BadZipFile: File is not a zip file" I have a simple scripts that reads a zip file in the same way as any other file into a string, then sends it across to a netwo

Re: Installing paramiko and pycrypto

2008-07-01 Thread GHZ
I installed from here: http://bazaar-vcs.org/WindowsInstall first pycrypto-2.0.1.win32-py2.5.zip then paramiko-1.7.1-ctypes.win32.exe -- http://mail.python.org/mailman/listinfo/python-list

Re: Error from zipfile

2008-07-01 Thread Marc 'BlackJack' Rintsch
On Tue, 01 Jul 2008 16:38:23 +0100, Wesley Brooks wrote: > Dear Users, > > I'm having a problem when trying to move script from Linux to Windows. > A zipfile opperation is failing with the message: > > "BadZipFile: File is not a zip file" > > I have a simple scripts that reads a zip file in the

Discover Islam - The Fastest Growing Religion in the World !

2008-07-01 Thread ah
Correct your information about Islam , The Misunderstood Religion When you are ready_ you can enter this place!!! http://sultan.org -- http://mail.python.org/mailman/listinfo/python-list

Re: wrong md5 checksum

2008-07-01 Thread kkwweett
kkwweett a écrit : Hi, the download page (http://www.python.org/download/releases/3.0/) for Python 3000 shows : 9119625244b17aa35ed94b655a2b2135 13491200 python-3.0b1.msi but I got 9119625244a57aa35ed94b655a2b2135 13491200 python-3.0b1.msi (44a57 rather than 44b17 ) with several md5 c

Re: dynamically load from module import xxx

2008-07-01 Thread Neal Becker
Guilherme Polo wrote: > On Tue, Jul 1, 2008 at 12:11 PM, Neal Becker <[EMAIL PROTECTED]> wrote: >> What is a good way to emulate: >> >> from module import xxx >> where 'module' is a dynamically generated string? >> >> __import__ ('modulename', fromlist=['xxx']) >> >> seems to be what I want, but t

Re: How to use gnu readline library in program?

2008-07-01 Thread Peter Otten
Grant Edwards wrote: > I'm trying to figure out how to use the gnu readline library so > that when my program is prompting the user for input there is > line editing and history support. > > I've read and re-read the documentation for the "readline" > module in the standard library and I still ca

Re: Embedding Python

2008-07-01 Thread Marcin Krol
Pau Freixes wrote: If you search this function name into Google you will can found some examples, use for example PyMarshal_ReadObjectFromString or PyMarshal_ReadObjectFromFile Rest assured I looked at a lot of code, but none of it was reading in the .pyc file. I had no idea about the 8-byte h

Re: Embedding Python

2008-07-01 Thread Marcin Krol
Carsten Haese wrote: python_code is a C string containing the raw bytes from your pyc file. Casting that to a PyObject pointer will not magically transform it into a Python code object. well yeah, I kind of didn't think that through.. A pyc file contains the following: 1) An 8 byte head

Re: Embedding Python

2008-07-01 Thread Marcin Krol
Hello everyone, In the meantime I managed to work out another solution, mainly thanks to reading the source code of some OSS projects. I post it here so somebody else looking for solution to this problem had the example available: cut #include #include #include #include #include

Classes for processing/parsing Wiki Markup text

2008-07-01 Thread Michael Mabin
Does anyone know if there are any generally available classes for parsing various wiki markup formats? -- | _ | * | _ | | _ | _ | * | | * | * | * | -- http://mail.python.org/mailman/listinfo/python-list

Re: wrong md5 checksum

2008-07-01 Thread Peter Pearson
On Tue, 01 Jul 2008 17:54:05 +0200, kkwweett <[EMAIL PROTECTED]> wrote: > kkwweett a écrit : >> Hi, >> >> the download page (http://www.python.org/download/releases/3.0/) for >> Python 3000 shows : >> >> 9119625244b17aa35ed94b655a2b2135 13491200 python-3.0b1.msi >> >> but I got >> >> 9119625

Re: dynamically load from module import xxx

2008-07-01 Thread Guilherme Polo
On Tue, Jul 1, 2008 at 12:55 PM, Neal Becker <[EMAIL PROTECTED]> wrote: > Guilherme Polo wrote: > >> On Tue, Jul 1, 2008 at 12:11 PM, Neal Becker <[EMAIL PROTECTED]> wrote: >>> What is a good way to emulate: >>> >>> from module import xxx >>> where 'module' is a dynamically generated string? >>> >>

Re: ask for a RE pattern to match TABLE in html

2008-07-01 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Jun 27, 10:32 am, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > > (ii) The regexes in languages like Python and Perl include > > features that are not part of the formal CS notion of > > "regular expression". Do t

Re: How to use gnu readline library in program?

2008-07-01 Thread Grant Edwards
>> What I want to do is replace sys.stdin.readline() with >> something that will provide the user with line editing and >> history recall. In other languages, one uses the Gnu readline >> library to do that, but my reading of the Python library >> documentation is that's not what the Python readli

Re: Classes for processing/parsing Wiki Markup text

2008-07-01 Thread Joshua Kugler
Michael Mabin wrote: > Does anyone know if there are any generally available classes for parsing > various wiki markup formats? Several here: http://pypi.python.org/pypi?%3Aaction=search&term=wiki&submit=search I'm sure you could find a good one, and add your own markup if needed. j -- http:/

convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Peter Bulychev
Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly similar ascii characters. For

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Laszlo Nagy
Peter Bulychev wrote: Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly si

Convert string to char array

2008-07-01 Thread Brandon
How do I convert a string to a char array? I am doing this so I can edit the string received from an sql query so I can remove unnecessary characters. -- http://mail.python.org/mailman/listinfo/python-list

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Peter Bulychev
Thank you for you answer. If you only want this to work for a subset, please define that subset. Actually, I want to convert only punctuations (dots, commas, hyphens and so on). -- Best regards, Peter Bulychev. -- http://mail.python.org/mailman/listinfo/python-list

Re: connecting to DBMS

2008-07-01 Thread teebes
On Jul 1, 9:35 am, varun chadha <[EMAIL PROTECTED]> wrote: > i am a newbie to python and is working on an application which needs > to connect to the database. can anyone guide me through the DBMS that > i can use and the module to connect to it. currently i have MySQL > installed using the link on

Re: Convert string to char array

2008-07-01 Thread Larry Bates
Brandon wrote: How do I convert a string to a char array? I am doing this so I can edit the string received from an sql query so I can remove unnecessary characters. The precise answer is: >>> s = 'abcdefghi' >>> l = list(s) >>> l ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] >>> But qui

Re: Convert string to char array

2008-07-01 Thread Mike Kent
On Jul 1, 2:49 pm, "Brandon" <[EMAIL PROTECTED]> wrote: > How do I convert a string to a char array?  I am doing this so I can edit > the string received from an sql query so I can remove unnecessary > characters. Answering your specific question: Python 2.5.1 (r251:54863, Mar 31 2008, 11:09:52)

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread Terry Reedy
nickola wrote: Hello to all I'm about to write a simulator for a microcontroller in python (why python? because I love it!!!) but I have a problem. The registry of this processor are all 8 bit long (and 10 bit for some other strange register) and I need to simulate the fixed point behavio

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Laszlo Nagy
Peter Bulychev wrote: Thank you for you answer. If you only want this to work for a subset, please define that subset. Actually, I want to convert only punctuations (dots, commas, hyphens and so on). Then make your translation table manually and apply this method: unicode.translate Fina

Re: Getting sorting order

2008-07-01 Thread Tobiah
master,slave1,slave2=zip(*x) What does the asterisk do here? Thanks ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert string to char array

2008-07-01 Thread Brandon
Thank you both for your help. "Mike Kent" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jul 1, 2:49 pm, "Brandon" <[EMAIL PROTECTED]> wrote: > How do I convert a string to a char array? I am doing this so I can edit > the string received from an sql query so I can remove unnecess

Please check my understanding...

2008-07-01 Thread Tobiah
list.append([1,2]) will add the two element list as the next element of the list. list.extend([1,2]) is equivalent to list = list + [1, 2] and the result is that each element of the added list becomes it's own new element in the original list. Is that the only difference? >From the manual: s.ex

Re: Implementing an 8 bit fixed point register

2008-07-01 Thread Grant Edwards
On 2008-07-01, Terry Reedy <[EMAIL PROTECTED]> wrote: > > > nickola wrote: >> Hello to all >> I'm about to write a simulator for a microcontroller in python >> (why python? because I love it!!!) >> >> but I have a problem. >> >> The registry of this processor are all 8 bit long (and 10 bit fo

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Terry Reedy
Peter Bulychev wrote: Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly

Re: ImportError: No module named _md5

2008-07-01 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hello, Does anyone know how to fix this error when trying to build MySQL- python-1.2.2: python setup.py build Traceback (most recent call last): File "setup.py", line 5, in import ez_setup; ez_setup.use_setuptools() File "/Users/jasonnerida/Downloads/MySQL-pyth

Re: Please check my understanding...

2008-07-01 Thread Matimus
On Jul 1, 12:35 pm, Tobiah <[EMAIL PROTECTED]> wrote: > list.append([1,2]) will add the two element list as the next > element of the list. > > list.extend([1,2]) is equivalent to list = list + [1, 2] > and the result is that each element of the added list > becomes it's own new element in the orig

How to make a function associated with a class?

2008-07-01 Thread Kurda Yon
Hi, I have a class called "vector". And I would like to define a function "dot" which would return a dot product of any two "vectors". I want to call this function as follow: dot(x,y). Well, I can define a functions "dot" outside the class and it works exactly as I want. However, the problem is

Re: Please check my understanding...

2008-07-01 Thread [EMAIL PROTECTED]
On 1 juil, 21:35, Tobiah <[EMAIL PROTECTED]> wrote: > list.append([1,2]) will add the two element list as the next > element of the list. list.append(obj) will add obj as the last element of list, whatever type(obj) is. > list.extend([1,2]) is equivalent to list = list + [1, 2] Not quite. The se

Re: Why is recursion so slow?

2008-07-01 Thread Nick Craig-Wood
Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > is that what lazy evaluation in functional languages avoids thus > > making recursive versions much faster? > > Not exactly... Functional languages are (or should be) optimized for > recursion, > but if the algorithm you write is still exponential

Re: raw_input into Tkinter ?

2008-07-01 Thread Sebastian "lunar" Wiesner
Matimus <[EMAIL PROTECTED]>: > On Jun 30, 9:55 am, [EMAIL PROTECTED] wrote: >> Is there any way to type into a Tkinter frame window? >> I want to use raw_input() within a Tkinter frame. > > `raw_input(prompt)` just calls `sys.stdout.write(prompt)` and returns > `sys.stdin.readline()`. It does mor

Re: Please check my understanding...

2008-07-01 Thread Marc 'BlackJack' Rintsch
On Tue, 01 Jul 2008 12:35:01 -0700, Tobiah wrote: > list.append([1,2]) will add the two element list as the next > element of the list. > > list.extend([1,2]) is equivalent to list = list + [1, 2] > and the result is that each element of the added list > becomes it's own new element in the origin

Re: Why is recursion so slow?

2008-07-01 Thread [EMAIL PROTECTED]
On 1 juil, 22:46, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: (snip) > By definition any function in a functional language will > always produce the same result if given the same arguments, This is only true for pure functional languages. I know you know it, but someone might think it also appli

Re: How to make a function associated with a class?

2008-07-01 Thread [EMAIL PROTECTED]
On 1 juil, 22:43, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I have a class called "vector". And I would like to define a function > "dot" which would return a dot product of any two "vectors". I want > to call this function as follow: dot(x,y). > > Well, I can define a functions "dot" outside

Attribute reference design

2008-07-01 Thread chamalulu
Hello. I think I'm aware of how attribute access is resolved in python. When referencing a class instance attribute which is not defined in the scope of the instance, Python looks for a class attribute with the same name. (For assignment or deletion this is not the case, thankfully.) I've been tryi

Re: Attribute reference design

2008-07-01 Thread Diez B. Roggisch
chamalulu schrieb: Hello. I think I'm aware of how attribute access is resolved in python. When referencing a class instance attribute which is not defined in the scope of the instance, Python looks for a class attribute with the same name. (For assignment or deletion this is not the case, thankf

Re: How to make a function associated with a class?

2008-07-01 Thread Kurda Yon
On Jul 1, 5:01 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 1 juil, 22:43, Kurda Yon <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I have a class called "vector". And I would like to define a function > > "dot" which would return a dot product of any two "vectors". I want > > to call t

Re: Getting sorting order

2008-07-01 Thread Nick Craig-Wood
Tobiah <[EMAIL PROTECTED]> wrote: > master,slave1,slave2=zip(*x) > > What does the asterisk do here? > > Thanks > ** Posted from http://www.teranews.com ** Instead of passing a single argument x to zip() you can think of it unpacking the list x and passing len(x) arguments to zip. So if

Re: Why is recursion so slow?

2008-07-01 Thread Rich Harkins
Nick Craig-Wood wrote: [snip] By definition any function in a functional language will always produce the same result if given the same arguments, so you can memoize any function. Ah, so that's why time.time() seems to be stuck... ;) Rich -- http://mail.python.org/mailman/listinfo/python-li

Re: How to make a function associated with a class?

2008-07-01 Thread Victor Noagbodji
> > Hi, > > I have a class called "vector". And I would like to define a function > "dot" which would return a dot product of any two "vectors". I want > to call this function as follow: dot(x,y). > > Well, I can define a functions "dot" outside the class and it works > exactly as I want. However,

Combination of element-wise and matrix multiplication

2008-07-01 Thread Jonno
I have two 2x2 arrays a & b. a=(([c,d],[e,f])) b=(([g,h],[i,j])) Each of c,d,e,f,g,h,i,j are all 1xN arrays I want to matrix multiply a & b to create a 2x2 array x, where the elements of x are created with element-wise math and result in the following: x[0,0] = c*g+d*i x[0,1] = c*h+d*j x[1,0] = e*g

AttributeError with embedded Python

2008-07-01 Thread PlayDough
I've embedded Python in an extension for a program we are using here at work. And I'm a bit stumped as to why I am getting an AttributeError only in the embedded Python. First, a bit of what I am doing. We use a simulator for a microprocessor we are using in our systems. Our simulator allows fo

  1   2   >