473,543 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
30
1,981
thread by: mmgarvey | last post Oct 29 '08 by: Terry Reedy
Hi, I'm using python to develop some proof-of-concept code for a cryptographic application. My code makes extended use of python's native bignum capabilities. In many cryptographic applications there is the need for a function 'get_highest_bit_num' that returns the position number of the highest set bit of a given integer. For example:
30
9,078
thread by: imran akhtar | last post Dec 29 '08 by: bvdet
i have a balckjack code, which does not seem to run, in python, it comes up with syntax error, i have try sortng it out. does not seem to work. below is my code, if anyone can work out wht wrong with it. that will be great. thereis an attched file, to see the code more cleaer. from random import choice as randomcards def total(hand): ...
29
11,647
thread by: Catalin | last post Jul 18 '05 by: Ian Bicking
Can Python replace PHP? Can I use a python program to make an interface to a mysql 4.X database? If that's possible where can I find a tutorial?
29
3,571
thread by: Bart Nessux | last post Jul 18 '05 by: Dave Cole
Just fooling around this weekend. Wrote and timed programs in C, Perl and Python. Each Program counts to 1,000,000 and prints each number to the console as it counts. I was a bit surprised. I'm not an expert C or Perl programming expery, I'm most familiar with Python, but can use the others as well. Here are my results: C = 23 seconds...
29
22,127
thread by: Mark Hahn | last post Jul 18 '05 by: Fredrik Lundh
We are considering switching to the dollar sign ($) for self, instead of the period ( . ) we are using now in Prothon. Ruby uses the at-sign (@) for self, but our new usage of self also includes replacing the period for some attribute references, as in obj$func() versus obj.func(), and too many programs treat that as an email address and...
29
1,977
thread by: David MacQuigg | last post Jul 18 '05 by: Hung Jung Lu
On 27 Apr 2004 16:34:56 -0700, has.temp2@virgin.net (has) wrote: >David MacQuigg <dmq@gain.com> wrote in message news:<bniq80hiib0gauiltuntk9jvia2getbnj4@4ax.com>... > >> Example of Simplified Classes ( Prototypes ) >> ============================================ > > > >Class-based OOP by any other name. But then, I've pointed this out
29
3,402
thread by: Maurice LING | last post Jul 18 '05 by: Jacob Hallen
Hi, I remembered reading a MSc thesis about compiling Perl to Java bytecodes (as in java class files). At least, it seems that someone had compiled scheme to java class files quite successfully. I'm wondering if something of such had been attempted in python, as in compiling X language into .pyc. I do not understand the schematics of .pyc...
29
2,435
thread by: Stephen Ferg | last post Jul 18 '05 by: Stephen Ferg
I am a very satisfied user of Python and have been for number of years. I would never willing use another language. I wish all good things for Python, and that moves me to express some thoughts about Python's future prospects. I submit that the future expansion of Python usage is constrained by Python's lack of a CPAN-like facility, and I...
29
3,370
thread by: George Sakkis | last post Jul 18 '05 by: jfj
Why does slicing a tuple returns a new tuple instead of a view of the existing one, given that tuples are immutable ? I ended up writing a custom ImmutableSequence class that does this, but I wonder why it is not implemented for tuples. George
29
2,105
thread by: Steven Bethard | last post Jul 18 '05 by: Nick Craig-Wood
Fuzzyman wrote: > Cameron Laird wrote: > > >>This is a serious issue. >> >>It's also one that brings Tcl, mentioned several >>times in this thread, back into focus. Tcl presents >>the notion of "safe interpreter", that is, a sub- >>ordinate virtual machine which can interpret only
29
2,015
thread by: Scott David Daniels | last post Jul 18 '05 by: Scott David Daniels
Kind of fun exercise (no good for British English). def units(value, units='bytes'): magnitude = abs(value) if magnitude >= 1000: for prefix in Scott.Daniels@Acm.Org
29
4,189
thread by: Paul L. Du Bois | last post Jul 18 '05 by: Antoon Pardon
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found anything so far. Because I know someone will ask: no, the busy-waiting hasn't been a problem in my app. I'm just interested in reading the code. p
29
4,313
thread by: mrstephengross | last post Jul 19 '05 by: AnswerGuy
Hi all... How can I find out the number of significant digits (to the right of the decimal place, that is) in a double? At least, I *think* that's what I'm asking for. For instance: 0.103 --> 3 0.0103 --> 4 0.00103 --> 5 0.000103 --> 6 0.0000103 --> 7
29
3,183
thread by: Jeffrey Maitland | last post Jul 21 '05 by: Paul Rubin
Hello all, I am in the process of writing a multithreading program and what I was wondering is a sleep command in an executing function will affect the threads below it? Here is a basic example of what I mean. def main(): temp_var = True while temp_var == True: if
29
2,593
thread by: Steven D'Aprano | last post Aug 1 '05 by: Steven Bethard
Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: >>> (lambda y: y) < (lambda y: y) False Do the comparison again and things become even more bizarre: >>> (lambda y: y) < (lambda y: y) True
29
2,747
thread by: Frank Millman | last post Sep 14 '05 by: Frank Millman
Hi all I am writing a multi-user accounting/business system. Data is stored in a database (PostgreSQL on Linux, SQL Server on Windows). I have written a Python program to run on the client, which uses wxPython as a gui, and connects to the database via TCP/IP. The client program contains all the authentication and business logic. It has...
29
3,620
thread by: seberino | last post Dec 7 '05 by: hiddenharmony
I'm trying to move beyond Emacs/Vim/Kate and was wondering if Eclipse is better and if it is the *best* IDE for Python. Should I leave Emacs and do Python coding in Eclipse? Chris
29
2,189
thread by: Mike Meyer | last post Jan 9 '06 by: Mike Meyer
After spending time I should have been sleeping working on it, the try python site is much more functional. It now allows statements, including multi-line statements and expressions. You can't create code objects yet, so it's still more a programmable calculator than anything real. I've got some of the tutorial text (literally) up as well....
29
1,501
thread by: Mathijs | last post Jan 25 '06 by: Mathijs
Hi, Python beginner here and very much enjoying it. I'm looking for a pythonic way to find how many listmembers are also present in a reference list. Don't count duplicates (eg. if you already found a matching member in the ref list, you can't use the ref member anymore). Example1: ref= list=
29
1,719
thread by: Tuvas | last post Jan 30 '06 by: Tuvas
I have a function in a program that works something like this. def load_pic_data(width,heigth,inpdat, filt=TRUE): data='' total=0 tnum=0 size=100 for y in range(0,heigth): row='' for x in range(0,width):
29
2,847
thread by: Steve R. Hastings | last post Apr 9 '06 by: Fredrik Lundh
When you compile the expression for i in range(1000): pass does Python make an iterator for range(), and then generate the values on the fly? Or does Python actually allocate the list and then step through it? I was under the impression that recent releases of Python optimize this
29
16,446
thread by: 63q2o4i02 | last post May 24 '06 by: Paddy
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what I *want* at the end of this; I just have never taken on a programming task of this magnitude. I've seen that some are using python as a utility...
29
3,488
thread by: Ron Garret | last post May 21 '06 by: Martin v. Löwis
>>> u'\xbd' u'\xbd' >>> print _ Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in position 0: ordinal not in range(128) >>>
29
3,943
thread by: John Salerno | last post Aug 10 '06 by: Stephan Kuhagen
I understand the difference, but I'm just curious if anyone has any strong feelings toward using one over the other? I was reading that a disadvantage to the more general usage (i.e. env) is that it finds the first python on the path, and that might not be the proper one to use. I don't know if that's a real issue most of the time, but it's at...
29
2,610
thread by: jaysherby | last post Aug 9 '06 by: jaysherby
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can someone set me on the right path to what modules and calls to use to do that? You'd think that it would be a fairly simple proposition, but I can't...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.