[Q] Function Point Analysis (FPA) - Equivalent lines of code of Python
Hi,
In FPA, there are tables which shows equivalent lines of code for
each Function Point (FP) for a number of programming languages.
e.g. http://www.qsm.com/?q=resources/function-point-languages-table/index.html
However, I have yet to find the figures for Python.
Is someone able to advise the closest language equivalent.
Regards
|
9/9/2010 8:30:28 AM
|
1
|
Nicholas <yue.nicho...@gmail.com>
|
|
|
Confused about nested scopes and when names get added to namespaces
I'm having trouble understanding when variables are added to
namespaces. I thought I understood it, but my nested function
examples below have me very confused.
In each test function below I have an x variable (so "x" is in the
namespace of each test function). I also have a nested function in
each (innerFunc) that has different flavors of trying to access or
assign a variable named "x".
---
def test1():
print "running test1..."
x = 1
def innerFunc():
print "inner locals():",
print "%s" % locals() # x not present (yet)
x = 2
pri
|
9/8/2010 9:18:52 PM
|
3
|
Russell Warren <russandheat...@gmail.com>
|
executing script in fork
Hi There,
I want to trigger another script and having it running forked to my
mother process.
I googled around and came up with following:
commandlist=['./GPSsim.pl',proto,'files/gps.txt']
subprocess.Popen(commandlist)
print "GPS simulator started"
This however doesn't seem disconnect stdout but it still throws me
back to the shell.
How can I launch it with disconnected stdout and still continue
running further code in my mother script?
Thanks,
Ron
|
9/8/2010 6:43:50 PM
|
0
|
cerr <ron.egg...@gmail.com>
|
Slice a list of lists?
I know that I can index into a list of lists like this:
a=[[1,2,3],[4,5,6],[7,8,9]]
a[0][2]=3
a[2][0]=7
but when I try to use fancy indexing to select the first item in each
list I get:
a[0][:]=[1,2,3]
a[:][0]=[1,2,3]
Why is this and is there a way to select [1,4,7]?
|
9/8/2010 6:55:50 PM
|
2
|
Jonno <jonnojohn...@gmail.com>
|
cPickle segfault with nested dicts in threaded env
Hi all,
Before creating an issue @ bugs.python.org I wanted to run the
following by everyone
We are having a difficult time with what looks like a cPickle issue
when given a data structure containing >15 nested dictionaries, but
only when threading is involved
Environment is FreeBSD 8, Python 2.5.5
The following diff contains an addition for
/usr/ports/lang/python25/work/Python-2.5.5/Lib/test/test_cpickle.py
which reproduces the issue
kenneth@kenneth0 Python-2.5.5 $ cat
/tmp/test_cpickle.nested_dicts_in_threaded_env.diff
1a2
> import copy
2a4
> import threading
93a96,
|
9/8/2010 6:58:22 PM
|
1
|
Kenneth Dombrowski <kdombrow...@gmail.com>
|
listening socket
Hi,
I'm trying to create a listening socket connection on port 1514.
I tried to follow the documentation at:
http://docs.python.org/release/2.5.2/lib/socket-example.html
and came up with following lines:
import socket
host = '' # Symbolic name meaning all available
interfaces
port = 1514 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
data = conn.recv(1024)
if not data: break
conn.send(data)
conn.close
|
9/8/2010 4:59:18 PM
|
0
|
cerr <ron.egg...@gmail.com>
|
are there pros or contras, keeping a connection to a (sqlite) database ?
hello,
I wrap my database in some class, and on creation of the instance, a connection to the database is
created,
and will stay connected until the program exists, something like this:
self.conn = sqlite3.connect ( self.filename )
Now I wonder if there are pros or contras to keep the connection to the database continuously "open" ?
thanks,
Stef Mientki
|
9/8/2010 5:09:12 PM
|
2
|
Stef Mientki <stef.mien...@gmail.com>
|
Automatic delegation in Python 3
Delegation in old-style classes worked fine:
# Python 2.6
>>> class Delegate:
.... def __init__(self, x):
.... self.__dict__['x'] = x
.... def __getattr__(self, name):
.... return getattr(self.x, name)
.... def __setattr__(self, name, value):
.... setattr(self.x, name, value)
....
>>> obj = Delegate({})
>>> obj[1] = None
>>> obj
{1: None}
But when I try the equivalent recipe with a new-style class, it behaves
differently:
>>> class Delegate2(object):
.... def __init__(self, x):
.... self.__dict__['x']
|
9/8/2010 1:58:05 PM
|
3
|
Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
|
Why Insulation is a Good Investment
Why Insulation is a Good Investment
Investing in products to make homes more energy efficient pays
significant dividends over a lifetime =97 with none of the wild
fluctuations of Wall Street. Insulation contributes to:
- Greater comfort
- Even temperature distribution
- Improved acoustics
- Better moisture control, which can reduce floor squeaks, drywall
cracks, structure damage and condensation
- Potential for increased resale value: Installing proper insulation
levels can also make your home more attractive to potential buyers.
In fact, most buyers list energy-efficiency as a
|
9/8/2010 12:25:20 PM
|
0
|
"......" <sustainable.future...@gmail.com>
|
audio time-stretching?
Does anyone know of a Python module for *moderate* "time-stretching"[1]
an MP3 (or AIFF) file?
FWIW, the audio I want to time-stretch is human speech.
TIA!
~K
[1] By "moderate time stretching" I mean, for example, taking an
audio that would normally play in 5 seconds, and stretch it so that
it plays in 7.5 seconds, keeping the pitch unchanged. A lot of
software out there does this badly; e.g. the time-stretched audio
springs extraneous "beats" of intensity that are very obtrusive
and annoying; I guess it's some weird wave self-interference effect.
Also, I stress *modera
|
9/7/2010 3:33:55 PM
|
0
|
kj <no.em...@please.post>
|
console-editor written in python
hi there,
greetings.
i am looking for a small, console-based (opensource) texteditor,
written in python (or as shellscript!), but i'm not finding something
usable.
very find would be emacs-keybindings ...
dank u well,
tanja
|
9/8/2010 8:51:12 AM
|
5
|
Tanje Toolate <tanja2l...@googlemail.com>
|
Re: include a file in a python program
Thanks all for your response i will try out this week, you have give
me sufficient hints.
Thanks again.
Bussiere
|
9/7/2010 11:47:47 PM
|
0
|
bussiere bussiere <bussi...@gmail.com>
|
formatted input
Hi All,
I have another question about formatted input. Suppose I am reading a
text file, and that I want it to be something like this
word11 = num11, word12 = num12, word13 = num13 etc...
word21 = num21, word22 = num12, word23 = num23 etc...
etc...
where wordx1 belongs to a certain dictionary of words, say dic1, while
wordx2 belongs to dic2, the numbers within some range and so on. I was
wondering if there is something in the standard library I may use to
check whether the file I am reading has a correct syntax according to
my rules/dictionaries instead of implementing my own rou
|
9/7/2010 9:26:11 PM
|
2
|
Bob <roberto.pagli...@gmail.com>
|
compare dictionaries
level: beginner
word= 'even'
dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
i want to know if word is entirely composed of letters in dict2
my approach:
step 1 : convert word to dictionary(dict1)
step2:
for k in dict1.keys():
if k in dict2:
if dict1[k] != dict2[k]:
return False
return True
return False
return True
by adding a print statement i can see that this simply ends too early
e.g. as soon as the first IF condition is met the loop exits
i think this is easy but google and pytho
|
9/7/2010 7:46:36 PM
|
9
|
Baba <raoul...@gmail.com>
|
Bug in Python 2.6 urlencode
There's a bug in Python 2.6's "urllib.urlencode". If you pass
in a Unicode character outside the ASCII range, instead of it
being encoded properly, an exception is raised.
File "C:\python26\lib\urllib.py", line 1267, in urlencode
v = quote_plus(str(v))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in
position 0: ordinal not in range(128)
This will probably work in 3.x, because there, "str" converts
to Unicode, and quote_plus can handle Unicode. This is one of
those legacy bugs left from the pre-Unicode era.
There's a workaround. Cal
|
9/7/2010 7:02:07 PM
|
5
|
John Nagle <na...@animats.com>
|
datetime questions
Hello
Learning python datetime somewhat similar to SQL type timestamp my
attempt creating a 24 h 2 months ago is
str(datetime.now () - timedelta (days = 60)) +' cron '+
str(datetime.now () - timedelta (days = 59))
Do you agree? Can I improve this declaration?
Regards
Niklas Rosencrantz
|
9/7/2010 5:27:23 PM
|
0
|
Niklasro <nikla...@gmail.com>
|
Volunteer help with porting
Hi everyone,
My name is Prashant Kumar and I wish to contribute to the Python
development process by helping convert certain existing python over to
python3k.
Is there anyway I could obtain a list of libraries which need to be
ported over to python3k, sorted by importance(by importance i mean
packages which serve as a dependency for larger number of packages
being more important).
I had originally mailed the python-dev mailing list and was pointed to
this ML so that I could get details regarding 3rd party libraries
which need to be ported.
Thanks,
Prashant Kumar
|
9/7/2010 2:48:57 PM
|
0
|
Prashant Kumar <contactprashan...@gmail.com>
|
knowing the caller of an import && exec question
i've got toto.py :
import titi
def niwhom():
pass
and titi.py :
def nipang():
pass
how can i know in titi.py that's it's toto.py that is calling titi.py
and the path of toto ?
And
why :
bidule.py :
class bidetmusique:
pass
truc.py :
X = __import__("bidule")
why exec("X.bidetmusique()") return none
and X.bidetmusique() return an object ?
How could i do to make this string "X.bidetmusique()" return an object ?
Regards and thanks
Bussiere
Eat the strawberry
Google Fan boy
|
9/7/2010 2:31:34 PM
|
1
|
bussiere bussiere <bussi...@gmail.com>
|
another way to sort like l.sort(key=lambda x:(x[0][0], -x[1][0]))
I have a list of tuples.
l = [((30,50),(70)), ((50,20),(20))]
for i in range(10):
k = ((i+30,i+50),(i+70))#suppose creating new tuple in each iteration
using some random value and in sert it into list.
flag=True
for i, v in enumerate(l):
if v >= k:
l.insert(i,k)
flag = False
break
if flag:
l.append(k)
This code will give a list of tuples sorted in asc order.
I need to change this code to sort this list by k[0][0] ascending and
k[0][1] descending.
What are the modifications needed in this code.
I dont want to user sort() method of list
|
9/7/2010 1:24:06 PM
|
7
|
sajuptpm <sajup...@gmail.com>
|
The PSF Blog Gets a Transfusion!
The Python Software Foundation=92s Blog staff has been recently expanded
by a new set of top-notch bloggers to bring you the latest in PSF
news, ranging from the scintillating projects that the PSF has its
fingers in to the mundane, but necessary board minutes.
Don=92t despair if you hate reading blogs! The blog also has a handy RSS
feed and a mailing list! You can take your pick of these delivery
methods by visiting the blog, at http://pyfound.blogspot.com/
|
9/6/2010 8:16:58 PM
|
0
|
Mike Driscoll <kyoso...@gmail.com>
|
How to determine if a Python script is being run right after startup on Windows
Hello!
I'm a newbie to Python (literally just started last Saturday), and I
coded a program that selects a random wallpaper from a directory and
swaps it with your current one (Windows only.)
What I'm looking to do is have it start up with Windows and
automatically swap the wallpapers. This part I have already coded, and
as far as I know, it should work. However, I want the user to be able
to access the GUI after this initial running of the program. The way
it is set up now, enabling "Start Up Mode" will cause the program to
cycle the wallpapers and then immediately exit.
My qu
|
9/7/2010 5:19:46 AM
|
1
|
Ryan George <ragma...@gmail.com>
|
The Samurai Principle
Pythonistas:
The "Samurai Principle" says to return victorious, or not at all. This
is why django.db wisely throws an exception, instead of simply
returning None, if it encounters a "record not found".
I illustrated the value of that concept, here:
http://c2.com/cgi/wiki?SamuraiPrinciple
|
9/7/2010 3:48:08 AM
|
27
|
Phlip <phlip2...@gmail.com>
|
Minimum and Maximum of a list containing floating point numbers
I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881',
'1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689',
'3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601',
'9.0601']. What I want to do is to find minimum and maximum number in
this list.
I used min function,
s = ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881',
'1.1881', '1.1881', '1.1881', '1.1881', '1.7689',
'1.7689', '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601',
'9.0601', '9.0601']
print min(s)
print max(s)
these gives me
1.181
9.0601
ma
|
9/7/2010 12:37:33 AM
|
9
|
ceycey <cuneyt.er...@gmail.com>
|
Database problems
Dear Pythonistas,
For a project I'm working on, I need to store fairly large
dictionaries (several million keys) in some form (obviously not in
memory). The obvious course of action was to use a database of some
sort.
The operation is pretty simple, a function is handed a generator that
gives it keys and values, and it maps the keys to the values in a non-
relational database (simples!).
I wrote some code implementing this using anydbm (which used dbhash on
my system), and it worked fine for about a million entries, but then
crashed raising a DBPageNotFoundError. I did a little
|
9/6/2010 7:01:27 PM
|
1
|
Edward Grefenstette <egre...@gmail.com>
|
using modules
The following code runs OK under 3.1:
@filename=cats_and_dogs.py
#!/usr/bin/python
def make_sound(animal):
print(animal + ' says ' + sounds[animal])
sounds = { "cat": "meow", "dog": "woof" }
for i in sounds.keys():
make_sound(i)
# output:
# dog says woof
# cat says meow
When I move the def to it's own file to create a module, it barfs:
@filename= cats_and_dogs.py
#!/usr/bin/python
import defs
sounds = { "cat": "meow", "dog": "woof" }
for i in sounds.keys():
defs.make_sound(i)
@filename=defs.py
def make_sound(animal):
print(animal + '
|
9/6/2010 4:55:03 PM
|
0
|
Sal Lopez <sal_lo...@me.com>
|
list of tuples with dynamic change in position
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)),
(('y','x'),(3,0))]
some functions using this list and fetch data using index l[0][1], l[1]
[1]
I need to change position of each values in the list and that dont
affect fuctions which are using this list.
I must have to use list of tuples.
Have any way to do it using list of tuples.
|
9/6/2010 2:54:23 PM
|
8
|
sajuptpm <sajup...@gmail.com>
|
redirecting stdout and stderr for a windows service
Hi all,
I am trying to redirect stdout and stderr on a python windows service,
so that the service will not stall after 256 chars is written, and so I
can use print for simple debugging.
I have the following 4 lines (copy/pasted) in the source of my code.
if __name__ == '__main__':
sys.stdout = sys.stderr = open("d:\logfile.txt", "a")
print "Starting up"
win32serviceutil.HandleCommandLine(PythonService)
When I run them as a free standing program, logfile.txt is created
the text placed in it, and it crashed on the last line - no permissions
to create a serv
|
9/6/2010 2:29:44 PM
|
1
|
Ian Hobson <...@ianhobson.co.uk>
|
ctypes and garbage collection
Hello,
I have used ctypes to wrap a C-library - it has been a really painless
experience!
The C-library instantiates a quite large "container-like" structure.
There are then several functions to inspect the content of the
container, get at items and free the whole thing:
/* C - code */
c_container_type * c_container_alloc( const char * filename );
c_node_type * c_container_get_node( c_container_type *
container , const char * node_id );
void c_container_free( c_container_type *
container );
.....
Observe that the c_container_get_node() function d
|
9/6/2010 12:28:15 PM
|
2
|
Joakim Hove <joakim.h...@gmail.com>
|
Learning variable visibility
Hi
How do I declare a variable visibility across files? Will import name
where name is name of the file do?
Thanks for instructing
Niklas Rosencrantz
|
9/6/2010 7:52:12 AM
|
1
|
"Niklasro(.appspot)" <nikla...@gmail.com>
|
GUibuilder evaluation
Hello
Making a GUI, could you recommend tkinter or any other proposal?
Thanks
|
9/6/2010 7:54:33 AM
|
5
|
Niklasro <nikla...@gmail.com>
|
MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INV
MAKE UPTO $5000 P/M $2000 IN FIRST 30 DAYS! NO INV
Generate $50 to $100 whenever you
have a couple of hours free time to spare.
You could make $50 or more in the next 2 hours.
Starting right Now!Today!
GET PAID TO:
Take online surveys and make from $5 to $75, or more
Participate in focus groups and make up to $150 an hour
Take phone surveys and you can earn as much as $120 an hour
Try new products (and keep the free products too)
Preview new movie trailers for $4 to $25 an hour
http://snipurl.com/11i6lw
Earn from your free website
Awesome earnings get paid for your honest
|
9/6/2010 4:26:33 AM
|
1
|
jameser <antonyjeeva...@rediffmail.com>
|
include a file in a python program
i've got a python.txt that contain python and it must stay as it (python.txt)
how can i include it in my program ?
import python.txt doesn't work
is there a way :
a) to make an include("python.txt")
b) tell him to treat .txt as .py file that i can make an import python ?
i'am using python3
Regards
Bussiere
fan of torchwood
Google Fan boy
|
9/5/2010 10:57:30 PM
|
3
|
bussiere bussiere <bussi...@gmail.com>
|
accessing a text file
level: beginner
how can i access the contents of a text file in Python?
i would like to compare a string (word) with the content of a text
file (word_list). i want to see if word is in word_list. let's assume
the TXT file is stored in the same directory as the PY file.
def is_valid_word(word, word_list)
thanks
Baba
|
9/5/2010 9:47:33 PM
|
18
|
Baba <raoul...@gmail.com>
|
Class changes in circular imports when __name__ == '__main__'
Hi! I'm writing a package with several files in it, and I've found
that "isinstance" doesn't work the way I expect under certain
circumstances.
Short example: here are two files.
# fileone.py
import filetwo
class AClass( object ):
pass
if __name__ == '__main__':
a = AClass()
filetwo.is_aclass( a )
# filetwo.py
import fileone
def is_aclass( a ):
print "The argument is", ("" if isinstance(a, fileone.AClass) else
"not"), "an instance of fileone.AClass"
If you run fileone.py, it will tell you that "The argument is not an
instance of fileone.AClass", which s
|
9/5/2010 8:19:46 PM
|
5
|
Spencer Pearson <speeze.pear...@gmail.com>
|
Extracting item from list of tuples?
I'm using httplib, and want to get the Location header from the
response. The getheaders() method gives you back a list of (name,
value) tuples. It would be a lot more convenient if it gave you back a
dict, but it is what it is.
Anyway, I came up with:
location = [t[1] for t in headers if t[0] == 'location'][0]
which works, but is getting on towards the cryptic end of things. Is
there a better idiom for this?
|
9/5/2010 5:09:03 PM
|
4
|
Roy Smith <...@panix.com>
|
personal firewall software is blocking the connection
I'am getting this annoying message all the time when using IDLE.
.... personal firewall software is blocking the connection
When I am editing a source *.py file and I click on F5 (run) I get the
above message.
What can I do?
I am using Norton Internet Security. I try to find if 127.0.0.1 is
blocked, but I do not know where to look.
Can anybody help?
|
9/5/2010 4:00:23 PM
|
0
|
vsoler <vicente.so...@gmail.com>
|
doctest annoyance/puzzle
I'm writing a "literate programming" document, example.txt, which mixes
text and code in ReST format:
This is my excellent module for making spam. It has
one public function, ``make_spam``, which takes a
single argument for how much spam to make:
>>> from module import make_spam
>>> make_spam(3)
'spam spam spam'
If you ask for too little spam, you get a bonus:
>>> make_spam(-3)
'spam spam spam GLORIOUS SPAM!!!'
I run the doctests with:
python2.6 -m doctest examples.txt
and the first example passes, but the second fails with NameError:
ma
|
9/5/2010 3:30:29 PM
|
2
|
Steven D'Aprano <st...@REMOVE-THIS-cybersource.com.au>
|
Python [repair_cycorder_mov.py]
Trying to learn Python for a specific purpose to repair a quicktime
file that's corrupted, is it even possible to create a proof-of-
concept python script that generates a valid 'moov' atom from a
corrupt .mov video ?, "file size 1.3gb" (Kodak camera failed to
finalize file).
[IMG]http://a.imageshack.us/img337/5503/cycorder.jpg[/IMG]
By [URL=http://profile.imageshack.us/user/ctops].[/URL]
[IMG]http://a.imageshack.us/img375/9254/finallm.jpg[/IMG]
By [URL=http://profile.imageshack.us/user/ctops].[/URL]
<FORM METHOD="LINK" ACTION="https://docs.google.com/leaf?
id=0B52sCu28BET8Z
|
9/5/2010 12:44:16 PM
|
3
|
"ctops.legal" <ctops.le...@gmail.com>
|
High CPU utilization with Pylab
I am trying to plot a runtime graph using pylab. But the very purpose
of functionality is lost because of high CPU percentage hogged by
plotting the graph.
Here is the piece of code which I have written.
def timerfunc(ulcm, dlcm):
count=0
xaxis=[]
yaxis=[]
ion()
while 1:
xaxis.append(count)
dr=(((dlcm.sum)/dlcm.timer)*8)
dlcm.counter=0
yaxis.append(dr)
dlcm.sum=0
h=plot(xaxis,yaxis,'b')
draw()
count=count+1
time.sleep(dlcm.timer/1000.0)
if (count>100):
xlim(cou
|
9/5/2010 10:05:54 AM
|
1
|
Madhur <madhurr...@gmail.com>
|
Python 2.7 module path problems on OS X
Dear List,
I have a horrible feeling that this is in some way related to the new
user installation directory in 2.7,or some problem with the framework
built, but I'm having great trouble with the module search path on
2.7.
I usually install modules to install_lib =
~/Library/Python/$py_version_short/site-packages
I assumed that this would continue to work on 2.7.
Unfortunately, it seems not to. The installation is fine, but sys.path
only includes
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/pyt
|
9/5/2010 8:49:00 AM
|
0
|
Nicholas Cole <nicholas.c...@gmail.com>
|
Subclassing by monkey-patching
I'm attempting to implement a recursive directory monitor based on the
GIO file monitor in PyGTK. My approach is basically to take the
gio.FileMonitor returned by the method gio.File.monitor_directory(),
connect to the "changed" signal, and add or remove monitors on create/
delete events for subdirectories.
I'd really like to do this by subclassing gio.FileMonitor. But the
problem I'm having is that it's never explicitly initialised in user
code (but somewhere in gio.File.monitor_directory() ). So there's no
point in just declaring a subclass =97 where would I actually create an
ins
|
9/5/2010 5:40:49 AM
|
8
|
Jason <jason.hee...@gmail.com>
|
Network and socket programming in python
i want to learn network and socket programming but i would like to do
this in python.Reason behind this is that python is very simple and
the only language i know .
anybody can suggest me which book should i pick.
the book should have following specification--
1)not tedious to follow
2)lots of example
3)starts with some networking stuff and then get into codes
thanks in advance with regards.
|
9/5/2010 4:29:49 AM
|
4
|
shivram <shivramsha...@gmail.com>
|
Question about Reading Files
Hello. I am still really new to python and I have a project where I
am trying to use the data files from another program and write a new
program with new user interface and all. My first step was to open
one of the files in 'rb' mode and print the contents, but I am
unfamiliar with the format. Here is what was printed to the terminal:
b'URES\x04\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f
\x00\x00\x00\x03\t\x00c\x01\x00\x00\x0c#\x00\x00\x02\x1b\x00\x00\x00Y
\x00\x00\x00\x08\x98"\x00\x00t\x00\x00\x00\x01\'\x01\x00\x00z$
\x00\x00\x04,\xa7\x00\x00\xa1%\x00\x00\x05\x0b\x00
|
9/4/2010 11:04:35 PM
|
2
|
genxtech <jrmy.l...@gmail.com>
|
the script is failing without a useful report
hi all,
need your help. i get a traceback that doesn't tell much about the
actual error in my code:
Traceback (most recent call last):
File ".\eightqueens.py", line 32, in <module>
generate(n, x, col, up, down)
File ".\eightqueens.py", line 17, in generate
else: generate(n, x, col, up, down)
File ".\eightqueens.py", line 17, in generate
else: generate(n, x, col, up, down)
File ".\eightqueens.py", line 17, in generate
else: generate(n, x, col, up, down)
File ".\eightqueens.py", line 17, in generate
else: generate(n, x, col, up, down)
File ".\eig
|
9/4/2010 9:22:39 PM
|
2
|
nvictor <noagbodjivic...@gmail.com>
|
Error in Following python program
#/usr/bin/python
from numpy import matrix
n=input('Enter matrix range')
fr=open('mat.txt','r')
print ('Enter elements into the matrix\n')
a=matrix([[input()for j in range(n)] for i in range(n)])
for i in range(n):
for j in range(n):
print a[i][j]
print '\n'
When i run the above program the following error is Coming please
Error is
Enter matrix range3
Enter elements into the matrix
1
2
3
4
5
6
7
8
9
[[1 2 3]]
Traceback (most recent call last):
File "2.py", line 10, in <module>
print a[
|
9/4/2010 6:28:06 PM
|
2
|
Pramod <pram...@gmail.com>
|
pyla: python little algorithms
Dear all,
pyla stands for Python Little Algorithm is a project in pure Python
and includes simple, easy to use, yet powerful libraries for
- 2D/3D plotting using Gnuplot
- Matrix/Vector operations
- ODE solvers
- Optimization and nonlinear algebraic equation solvers
- ...
Homepage:
pyla home is: http://pyla.codeplex.com
pyla documentation is on Tiddlywiki (www.tiddlywiki.org) a lightweight
and portable wiki.
Current Status:
Currently the gplot library with status alpha has been released, other
libraries is planned to be released bi-monthly.
Contribution:
We welcome
|
9/4/2010 11:25:18 AM
|
0
|
atronoush <mohammad.rahm...@gmail.com>
|
what should __iter__ return?
Hi,
What is better:
def __iter__(self):
for i in len(self):
yield self[i]
or
def __iter__(self):
return iter([self[i] for i in range(len(self))])
The first one, I would say is more correct,
however what if in a middle of an iteration
the object changes in length? Then, the
iterator will fail with IndexError (if items
have been removed), or it will fail to iterate
over the whole sequence (if items have
been added).
What do you think?
Cheers.
Ernest
|
9/3/2010 7:35:48 PM
|
5
|
ernest <nfdi...@gmail.com>
|
New to python - parse data into Google Charts
I'm new to python and my programming years are a ways behind me, so I
was looking for some help in parsing a file into a chart using the
Google Charts API.
The file is simply a text file containing: Date, Total Accesses,
Unique Accesses.
I'd like date across the bottom, access numbers on the vertical axis
and lines for the amounts.
I'm not even really sure how to get started if someone wants to give
me some pointers or throw together a short example, I would greatly
appreciate it.
Here is a sample of the data:
2010-08-01, 2324, 1800
2010-08-02, 3832, 2857
2010-08-03, 791
|
9/3/2010 5:52:01 PM
|
2
|
alistair <alistair.cal...@gmail.com>
|
pyqt signals
Hello i have write this but i not able to connect the emit of the
class Socket to the Form class, can you help me?
class Socket(QtNetwork.QTcpSocket):
def __init__(self, parent=None):
super(Socket, self).__init__(parent)
self.connect(self, QtCore.SIGNAL("readyRead()"),
self.leggi_richiesta)
def leggi_richiesta(self):
messaggio = self.readData(self.bytesAvailable())
print 'dati_letti = ', messaggio
self.emit(QtCore.SIGNAL("messaggio"), messaggio)
print 'segnale emesso'
class Form(QWidget, Ui_Form):
"""
Class doc
|
9/3/2010 3:16:34 PM
|
0
|
luca72 <lucabe...@libero.it>
|
IDLE / Black frame on Mac
Hi
I am new to python and have installed python 3.1.2. I have began using
IDLE and like it very good.
But when an IDLE window is active. There is a thick black frame around
the white text field. Is there some way I can get rid of this frame?
The frame is very distracting when I write.
Kristoffer
|
9/3/2010 3:09:02 PM
|
1
|
=?ISO-8859-1?Q?Kristoffer_F=F8llesdal?= <kkf...@gmail.com>
|