And to beat that poor horse in the same example, my current way of doing
that would be:
for alist in "lista", "listb":
print(alist, eval(alist))
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.pytho
On Thu, Jan 2, 2014 at 10:28 PM, Keith Winston wrote:
> Danny: I appreciate your point, but these are just for little code loops,
> nothing I need to hold on to, like the snippet above:
I hope you don't take offense. But I actually do not understand
print_candl_info(). I thought I did! But the
OMG, another one to Mark and not the list. I'll see if there's something I
can adjust in email...
On Fri, Jan 3, 2014 at 2:23 AM, Mark Lawrence wrote:
>
> lista = list(range(5))
> listb = list(reversed(range(5)))
> for alist in lista, listb:
> print(alist.__class__.__name__, alist)
>
> list [
I spoke about iterating through a bunch of lists in my last post, but in
fact I'm iterating through a bunch of dicts in the example I gave. Sorry.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.o
On 03/01/2014 06:55, Keith Winston wrote:
Mark wrote: You enjoy making life difficult for yourself :) You've
assigned strings to the name func, just assign the functions themselves?
Like.
for func in max, min:
print(func.__name__, func(range(5)))
Output.
max 4
min
Mark wrote: You enjoy making life difficult for yourself :) You've
assigned strings to the name func, just assign the functions themselves?
Like.
>
> for func in max, min:
> print(func.__name__, func(range(5)))
>
> Output.
>
> max 4
> min 0
>
>
I wouldn't say I enjoy making life difficult fo
On 03/01/2014 06:18, Keith Winston wrote:
Shoot: I sent this response directly to Mark, without even trimming.
Here it is to the list...
Hi Mark: sorry for unclarity. I am probably going to make a hash of
explaining this, but here goes:
I want to iterate a variable across a list of objects, and
Danny: I appreciate your point, but these are just for little code loops,
nothing I need to hold on to, like the snippet above: I'm just trying to
wrap a few things into one loop, which gives me flexibility about
expanding/contracting the stats, for example, that I print (by changing the
range list
Shoot: I sent this response directly to Mark, without even trimming. Here
it is to the list...
Hi Mark: sorry for unclarity. I am probably going to make a hash of
explaining this, but here goes:
I want to iterate a variable across a list of objects, and print both the
outputs (wrong word) of sai
Matthew Ngaha writes:
> im having problems importing sqlite3 on ubuntu python3.
>
> File "/usr/local/lib/python3.3/sqlite3/__init__.py", line 23, in
> from sqlite3.dbapi2 import *
> File "/usr/local/lib/python3.3/sqlite3/dbapi2.py", line 26, in
> from _sqlite3 import *
> ImportError
Sorry, I forgot to add. You titled the subject of the thread as:
"What's in a name?"
A good answer to your question is to permute the words a little.
Name is in a... <...>
where <...> is "what" you want to put the name in.
:P
___
Tutor ma
On Thu, Jan 2, 2014 at 9:22 PM, Keith Winston wrote:
> I've got the beginner's version of a question I think Denis asked
> recently...
>
> If I'm iterating a variable through a series of list names, for future
> processing, I would like to print the name of the list the variable is set
> to in a g
On 03/01/2014 05:29, Keith Winston wrote:
Hmm, maybe I stumbled upon at least one approach, turning the problem
around. Make it something like:
for i in ["alist", "blist", "clist"]
i[3] = "okey dokey "
print(eval(i)[3], i)
Of course I've been staring at this for a while, but as soon a
On 03/01/2014 05:22, Keith Winston wrote:
I've got the beginner's version of a question I think Denis asked
recently...
If I'm iterating a variable through a series of list names, for future
processing, I would like to print the name of the list the variable is
set to in a given moment... i.e.
Hmm, maybe I stumbled upon at least one approach, turning the problem
around. Make it something like:
for i in ["alist", "blist", "clist"]
i[3] = "okey dokey "
print(eval(i)[3], i)
Of course I've been staring at this for a while, but as soon as I post I
find a way... this is my first use
I've got the beginner's version of a question I think Denis asked
recently...
If I'm iterating a variable through a series of list names, for future
processing, I would like to print the name of the list the variable is set
to in a given moment... i.e.
for i in [alist, blist, clist]
i[3] = "o
Hi Matthew,
This might be an Ubuntu bug or deficiency.
The file you're looking for is for the underlying low-level C module
that bridges the world of SQLite and Python. By all rights, this
would have been provided by something like the "python-pysqlite2"
package, but that package is for Python
im having problems importing sqlite3 on ubuntu python3.
File "/usr/local/lib/python3.3/sqlite3/__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.3/sqlite3/dbapi2.py", line 26, in
from _sqlite3 import *
ImportError: No module named '_sqlite3'
i have
> Separately, I'm also curious about how to process big files. For example,
I
> was trying to play 100 million games of chutes & ladders
Without doing the 100,000,000, you could try either researching the nums,
or trying an algorithm that tried intervals, and narrowed down the best ,
and numerical
On Thu, Jan 2, 2014 at 11:21 AM, spir wrote:
> dir(C.__dir__) # here is __name__ :
It's good that you've brought up the special method __dir__, because
that's at the heart of the issue. In 3.3, objects use object.__dir__
unless the type overrides it:
>>> vars(object)['__dir__']
>>
> Separately, I'm also curious about how to process big files. For example, I
> was trying to play 100 million games of chutes & ladders, and I crashed my
> machine, I believe: the game results, including 4 ints & 2 short lists of
> ints per game, are gathered into a list, so it can become a pretty
On 01/02/2014 04:48 PM, eryksun wrote:
On Thu, Jan 2, 2014 at 5:12 AM, spir wrote:
Am I missing something or don't classes know how they're called (unlike
funcs, which have a __name__ attribute, very practicle)? Is there a way to
get it otherwise?
What are you smoking, and where can I get so
On 01/02/2014 02:40 PM, Steven D'Aprano wrote:
On Thu, Jan 02, 2014 at 11:12:30AM +0100, spir wrote:
Hello tutorians,
Am I missing something or don't classes know how they're called (unlike
funcs, which have a __name__ attribute, very practicle)? Is there a way to
get it otherwise?
py> type(4
On 01/02/2014 11:18 AM, Dominik George wrote:
Hi,
Am I missing something or don't classes know how they're called
(unlike funcs, which have a __name__ attribute, very practicle)? Is
there a way to get it otherwise?
The class has it, the instance doesn't. That said, you are looking for
self._
On Thu, Jan 2, 2014 at 4:15 AM, Keith Winston wrote:
> Thanks for all this Eryksun (and Mark!), but... I don't understand why you
> brought gdbm in? Is it something underlying shelve, or a better approach, or
> something else? That last part really puts me in a pickle, and I don't
> understand why
On Thu, Jan 2, 2014 at 10:48 AM, eryksun wrote:
> __class__ is a descriptor in the dict of `type`:
I think I must be smoking something, too. That should be __name__. Sorry.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription op
On Thu, Jan 2, 2014 at 5:12 AM, spir wrote:
>
> Am I missing something or don't classes know how they're called (unlike
> funcs, which have a __name__ attribute, very practicle)? Is there a way to
> get it otherwise?
What are you smoking, and where can I get some? ;)
Actually, I think I understa
On Thu, Jan 02, 2014 at 04:15:06AM -0500, Keith Winston wrote:
> Separately, I'm also curious about how to process big files. For example, I
> was trying to play 100 million games of chutes & ladders, and I crashed my
> machine, I believe: the game results, including 4 ints & 2 short lists of
> in
On Thu, Jan 02, 2014 at 11:12:30AM +0100, spir wrote:
> Hello tutorians,
>
> Am I missing something or don't classes know how they're called (unlike
> funcs, which have a __name__ attribute, very practicle)? Is there a way to
> get it otherwise?
py> type(42).__name__
'int'
py> class Spam:
...
Hi,
> Am I missing something or don't classes know how they're called
> (unlike funcs, which have a __name__ attribute, very practicle)? Is
> there a way to get it otherwise?
The class has it, the instance doesn't. That said, you are looking for
self.__class__.__name__ ...
> class SuperType:
>
Hello tutorians,
Am I missing something or don't classes know how they're called (unlike funcs,
which have a __name__ attribute, very practicle)? Is there a way to get it
otherwise?
The point is to have a super-type define a general __repr__ like eg:
class SuperType:
# ...
def __repr
Thanks for all this Eryksun (and Mark!), but... I don't understand why you
brought gdbm in? Is it something underlying shelve, or a better approach,
or something else? That last part really puts me in a pickle, and I don't
understand why.
Separately, I'm also curious about how to process big files
On 01/02/2014 03:21 AM, Steven D'Aprano wrote:
On Wed, Jan 01, 2014 at 02:49:17PM +0100, spir wrote:
On 01/01/2014 01:26 AM, Steven D'Aprano wrote:
On Tue, Dec 31, 2013 at 03:35:55PM +0100, spir wrote:
[...]
I take the opportunity to add a few features, but would do
without Source altogether
33 matches
Mail list logo