Dear all,I am using GEM5, a simulator, which uses python for reading
configuration files.
For example in Caches.py
http://repo.gem5.org/gem5/file/7d95b650c9b6/configs/common/Caches.py#l31
a class L1cache is defined which we can set its parameters (size, assoc, ...).
The BaseCache is fully define
I am not sure I understand your argument. The doc section states that
" [...] in Python you’re forced to write this:
while True:
line = f.readline()
if not line:
break
... # do something with line".
That simply isn't true as one can simply write:
for line in f:
#do s
On 03/25/12 07:18, Alexander Blinne wrote:
I am not sure I understand your argument. The doc section states that
" [...] in Python you’re forced to write this:
while True:
line = f.readline()
if not line:
break
... # do something with line".
That simply isn't true as on
On Mon, Mar 26, 2012 at 12:03 AM, Tim Chase
wrote:
> Granted, this can be turned into an iterator with a yield, making the issue
> somewhat moot:
No, just moving the issue to the iterator. Your iterator has exactly
the same structure in it.
Personally, I quite like assignment-in-conditional nota
On 03/25/12 08:11, Chris Angelico wrote:
On Mon, Mar 26, 2012 at 12:03 AM, Tim Chase
wrote:
Granted, this can be turned into an iterator with a yield, making the issue
somewhat moot:
No, just moving the issue to the iterator. Your iterator has exactly
the same structure in it.
Yeah, it has
On Mon, Mar 26, 2012 at 12:48 AM, Tim Chase
wrote:
> Yeah, it has the same structure internally, but I'm somewhat surprised that
> the DB connection object doesn't have an __iter__() that does something like
> this automatically under the covers.
Sure. That's definitely the truly Pythonic techniq
On 3/25/2012 0:35, Christian wrote:
Hey,
I struggle to "extend" a multiprocessing example to my problem with a
itertools.product result iterator.
How I have to assign the combos.next() elements approriate to
Pool.imap/calc functions?
Thanks in advance
Christian
from multiprocessing import Pr
On 3/25/2012 16:11, Chris Angelico wrote:
On Mon, Mar 26, 2012 at 12:48 AM, Tim Chase
wrote:
Yeah, it has the same structure internally, but I'm somewhat surprised that
the DB connection object doesn't have an __iter__() that does something like
this automatically under the covers.
Sure. Tha
On 3/25/2012 15:48, Tim Chase wrote:
The old curmudgeon in me likes the Pascal method of using "=" for
equality-testing, and ":=" for assignment which feels a little closer to
mathematical use of "=".
Unfortunately, ":=" means "is defined as" in mathematics. The "right"
operator would have bee
On Mar 25, 6:48 pm, Tim Chase wrote:
>
> The old curmudgeon in me likes the Pascal method of using "=" for
> equality-testing, and ":=" for assignment which feels a little
> closer to mathematical use of "=".
>
> -tkc
Carroll Morgan author of programming from specifications
http://www.cs.ox.ac.uk
On 03/25/12 10:16, Kiuhnm wrote:
On 3/25/2012 15:48, Tim Chase wrote:
The old curmudgeon in me likes the Pascal method of using "=" for
equality-testing, and ":=" for assignment which feels a little closer to
mathematical use of "=".
Unfortunately, ":=" means "is defined as" in mathematics. Th
Hello,
I'm having some difficulties with the interaction between bdb.Bdb and
scripts which contain unittest. Following are two simplified scenarios of a
GUI debugger Gedit plugin I'm writing based on bdb.Bdb, and a script that
is being debugged by it.
--Scenario A--
The script being debugg
On 25/03/2012 21:42, Ami Tavory wrote:
Hello,
I'm having some difficulties with the interaction between bdb.Bdb and
scripts which contain unittest. Following are two simplified scenarios
of a GUI debugger Gedit plugin I'm writing based on bdb.Bdb, and a
script that is being debugged by it.
Run this test program as root:
import os
print "before:", os.getgroups()
os.system("groups")
os.setgroups([])
print "after:", os.getgroups()
os.system("groups")
After the os.setgroups, os.getgroups says that the process is not in any
groups, just as you would expect. However the groups command
Am 25.03.2012 23:32, schrieb jeff:
After the os.setgroups, os.getgroups says that the process is not in
any groups, just as you would expect... I can suppress
membership in the root group only by doing os.setgid and os.setuid
before the os.system call (in which case I wind up in the group of
the
Tim Chase wrote:
> On 03/25/12 08:11, Chris Angelico wrote:
>> On Mon, Mar 26, 2012 at 12:03 AM, Tim Chase
>> wrote:
>>> Granted, this can be turned into an iterator with a yield, making the
>>> issue somewhat moot:
>>
>> No, just moving the issue to the iterator. Your iterator has exactly
>> th
On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote:
> Am 25.03.2012 23:32, schrieb jeff:
> > After the os.setgroups, os.getgroups says that the process is not in
> > any groups, just as you would expect... I can suppress
> > membership in the root group only by doing os.setgid and os.s
jeff <3bee...@gmail.com> writes:
> On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote:
> > Am 25.03.2012 23:32, schrieb jeff:
> > > but I have to be able to get back to root privilege so I can't use
> > > setgid and setuid.
> >
> > Simply not possible (i.e., you can't drop root privi
OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
What's the justification for that? I use those functions extensively
in my library of Collatz utilities and I had to re-edit them for no
obvious reason.
--
http://ma
On Sun, 25 Mar 2012 08:03:14 -0500, Tim Chase wrote:
> I think the complaint was backed by a bad example. Perhaps a DB example
> works better. With assignment allowed in an evaluation, you'd be able
> to write
>
>while data = conn.fetchmany():
> for row in data:
>process(row)
On Mar 26, 2:59 pm, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
Python is not gmpy. You might be better served asking the project
maintainer(s).
> What's the justification for that? I use
On Sun, 25 Mar 2012 17:16:16 +0200, Kiuhnm wrote:
> On 3/25/2012 15:48, Tim Chase wrote:
>> The old curmudgeon in me likes the Pascal method of using "=" for
>> equality-testing, and ":=" for assignment which feels a little closer
>> to mathematical use of "=".
>
> Unfortunately, ":=" means "is d
Hi All
How can we generate a 6 digit random number from a given number ?
eg:-
def number_generator(id):
random.randint(id,99)
When i am using this it is sometimes giving me five digit and sometimes 6 .
I want to avoid encryption . Can i have alphanumeric 6 digit random number
from this
If you want it as an int:
random.randint(10, 99)
Or as a string:
s = '%06d' % random.randint(0, 99)
On Mon, Mar 26, 2012 at 2:08 AM, Nikhil Verma wrote:
> Hi All
>
> How can we generate a 6 digit random number from a given number ?
>
> eg:-
>
> def number_generator(id):
> rando
On Mon, Mar 26, 2012 at 5:08 PM, Nikhil Verma wrote:
> Hi All
>
> How can we generate a 6 digit random number from a given number ?
>
> eg:-
>
> def number_generator(id):
> random.randint(id,99)
>
> When i am using this it is sometimes giving me five digit and sometimes 6 .
> I want to avo
* Nikhil Verma [2012-03-26 08:09]:
> Hi All
>
> How can we generate a 6 digit random number from a given number ?
what about this?
>>> given_number=123456
>>> def rand_given_number(x):
... s = list(str(x))
... random.shuffle(s)
... return int(''.join(s))
...
>>> print (rand_given_nu
Hi
I want something to achieve like this :-
def random_number(id): # I am passing it from request
# do something
return random_number
Output
random_number(5)
AXR670
One input that is a number in return you are getting 6 digit alphanumeric
string.
I tried this
s = '%06d' % random.randi
27 matches
Mail list logo