On 4/10/2014 6:26 PM, Saba Usmani wrote:
My task is :
Welcome to the tutor list. In what school are you learning Python?
What version of Python? What operating system? What do you use to write
and run your code?
What Python elements have you studied so far? Your code can be greatly
simpli
Saba Usmani Wrote in message:
>
>
You posted in html so I can't quote your code, but why aren't you
using int() to convert in one call? Second argument is the base
to be used.
value = int ("10011", 2)
othervalue = int ("234") # default to decimal
--
DaveA
_
On 11/04/2014 21:58, Saba Usmani wrote:
Hi,
I am meant to design code for a program that converts from binary number
to decimal and vice versa.
This is what i have so far:
print "Welcome to the binary and decimal converter"
loop = True
while loop:
bord = raw_input("Enter b for binary or d
Hi,
I am meant to design code for a program that converts from binary number to
decimal and vice versa.
This is what i have so far:
print "Welcome to the binary and decimal converter"loop = Truewhile loop:
bord = raw_input("Enter b for binary or d decimal or exit to exit")if bord
== "b":
Ok guys, when I wrote that email I was excited for the apparent speed
increasing (it was jumping the bottleneck for loop for the reason peter
otten outlined).
Now, instead the changes, the speed is not improved (the code still running
from this morning and it's at one forth of the dataset).
What c
On Fri, Apr 11, 2014 at 1:01 PM, Gabriele Brambilla
wrote:
> Yes,
> but I want to make a C extension to run faster a function from
> scipy.interpolate (interp1d)
>
> It woulldn't change anything?
This is precisely why you want to drive your optimization based on
what the profiler is telling you.
On Fri, Apr 11, 2014 at 1:01 PM, Gabriele Brambilla
wrote:
> Yes,
> but I want to make a C extension to run faster a function from
> scipy.interpolate (interp1d)
Just to emphasis: I believe your goal should be: "I want to make my
program fast."
Your goal should probably not be: "I want to write
I forget the reply all
-- Forwarded message --
From: Gabriele Brambilla
Date: 2014-04-11 16:03 GMT-04:00
Subject: Re: [Tutor] improving speed using and recalling C functions
To: Peter Otten <__pete...@web.de>
you are right.
probably this is the problem.
thanks
Gabriele
2014-
Yes,
but I want to make a C extension to run faster a function from
scipy.interpolate (interp1d)
It woulldn't change anything?
thanks
Gabriele
2014-04-11 14:47 GMT-04:00 Alan Gauld :
> On 11/04/14 09:59, Peter Otten wrote:
>
>> Gabriele Brambilla wrote:
>>
>> Anyway I would like to try to sp
Gabriele Brambilla wrote:
> ok, it seems that the code don't enter in this for loop
>
> for gammar, MYMAP in zip(gmlis, MYMAPS):
>
> I don't understand why.
You have two variables with similar names, gmlis and gmils:
>> gmlis = []
>> gmils=[my_parts[7], my_part
On 4/11/2014 1:13 PM, Andoni Gorostiza wrote:
Hi tutor. I need your help with something I don't understand. In the
tutorial, it mentions an example of a range within a range. I'll keep
it simplified. How exactly does this work? I'll provide a few examples.
>>> for x in range(0,5):
...for n in
Excellent. I guess I never read through the class stuff in learning
python(its a great book, but very detailed) Now I know better!
--
http://about.me/greggmartinson
On Fri, Apr 11, 2014 at 3:32 AM, Peter Otten <__pete...@web.de> wrote:
> Gregg Martinson wrote:
>
> > I have been working thr
Hi tutor. I need your help with something I don't understand. In the tutorial,
it mentions an example of a range within a range. I'll keep it simplified. How
exactly does this work? I'll provide a few examples.
>>> for x in range(0,5):
...for n in range(0,5):
... print(x)
>>> for x in
On 11/04/14 09:59, Peter Otten wrote:
Gabriele Brambilla wrote:
Anyway I would like to try to speed it up using C functions
...
posted looks like it has great potential for speed-up by replacing the inner
loops with numpy array operations.
And in case its not obvious much(most?) of numPy con
this is the profile for a sample of 1000 elements
Fri Apr 11 10:21:21 2014restats
31594963 function calls in 103.708 seconds
Ordered by: internal time
List reduced from 47 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
ok
modifying the for in this way (zipping an array of matrix drive it crazy)
it works
dko=0
for gammar in gmils:
omC = (1.5)*(gammar**3)*c/(rho*rlc)
gig = omC*hcut/eVtoErg
#check the single emission
ok, it seems that the code don't enter in this for loop
for gammar, MYMAP in zip(gmlis, MYMAPS):
I don't understand why.
Thanks
Gabriele
2014-04-11 9:56 GMT-04:00 Gabriele Brambilla :
> Hi, I'm sorry but there is a big problem.
> the code is producing empty file.dat.
>
> I think it's because
Hi, I'm sorry but there is a big problem.
the code is producing empty file.dat.
I think it's because of this that previously I have done that strange trick
of myinternet...
So:
for my_line in open('data.dat'):
myinternet = []
gmlis = []
print('r
Hi Danny,
I'm quiet impressed.
the program takes near 30 minutes instead of more than 8 hours!
this is the profile:
Fri Apr 11 09:14:04 2014restats
19532732 function calls in 2105.024 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno
I think I have Cython already installed with Anaconda.
How it works?
Thanks
Gabriele
2014-04-11 8:16 GMT-04:00 Albert-Jan Roskam :
>
> > From: Gabriele Brambilla
> >To: Danny Yoo
> >Cc: python tutor
> >Sent: Friday, April 11, 2014 5:30 AM
> >Subject: Re: [T
> From: Gabriele Brambilla
>To: Danny Yoo
>Cc: python tutor
>Sent: Friday, April 11, 2014 5:30 AM
>Subject: Re: [Tutor] improving speed using and recalling C functions
>
>
>
>Hi Danny,
>I followed your suggestion.
>Tomorrow morning I will run this new version
Gabriele Brambilla wrote:
> Anyway I would like to try to speed it up using C functions (and maybe
> comparing the resuts of the two profile in the end)
I can't help you on your chosen path, but let me emphasise that the code you
posted looks like it has great potential for speed-up by replacing
Gregg Martinson wrote:
> I have been working through a fairly simple process to teach myself python
> and I am running into a problem with a comparison. Can anyone tell me
> where I am going wrong?
>
> #!/usr/bin/env python
>
> class Team(object):
> code = ""
> opponents_debated=[]
>
On 11/04/14 00:27, Gregg Martinson wrote:
I have been working through a fairly simple process to teach myself
python and I am running into a problem with a comparison. Can anyone
tell me where I am going wrong?
#!/usr/bin/env python
class Team(object):
code = ""
opponents_debated=[]
I have been working through a fairly simple process to teach myself python
and I am running into a problem with a comparison. Can anyone tell me
where I am going wrong?
#!/usr/bin/env python
class Team(object):
code = ""
opponents_debated=[]
wins=0
losses=0
competitors=[]
Forwarding to tutor; need to sleep tonight.
-- Forwarded message --
From: Saba Usmani
Date: Thu, Apr 10, 2014 at 11:35 PM
Subject: Re: [Tutor] Refining Code
To: Danny Yoo
Hi,
Yes I did use copy and paste sometimes- is that bad? How could you
tell and what are the similarities
26 matches
Mail list logo