On Sun, 30 May 2010 00:36:24 +0200
Eike Welk wrote:
> Hey Denis!
>
> I waited for a thread like this to appear, because I have a quirky, but IMHO
> elegant, solution for those kinds of variables:
>
> class EnumMeta(type):
> def __repr__(self):
> return self.__name__
>
> class
Hello,
from the thread: "class methods: using class vars as args?"
On Sat, 29 May 2010 11:01:10 +1000
Steven D'Aprano wrote:
> On Fri, 28 May 2010 07:42:30 am Alex Hall wrote:
> > Thanks for all the explanations, everyone. This does make sense, and
> > I am now using the
> > if(arg==None): arg
On Fri, 28 May 2010 19:11:13 -0400
"Shawn Blazer" wrote:
>
> This problem told me to use map and filter, so how would I use that to
> solve it?
[some piece of interactive session]
> Thanks!
So, where's the problem?
Denis
vit esse estrany ☣
spir.wikidot.com
On Thu, 27 May 2010 20:00:46 -0600
Matthew Wood wrote:
> I THOUGHT the guaranteed same-ordering of dict.keys and dict.values started
> in python 2.6. That was a simple mistake.
>
> It turns out, that's not the case. But in general, access to dicts and sets
> is unordered, so you can't/don't/sh
On Sun, 23 May 2010 15:40:13 -0400
Alex Hall wrote:
> Hello all,
> I know Python reasonably well, but I still run into basic questions
> which those over on the other python list request I post here instead.
> I figure this would be one of them:
> Why would this not work:
>
> class c(object):
>
On Tue, 25 May 2010 21:47:19 -0400
Alex Hall wrote:
> I thought so, but I was hoping you would not say that as this means a
> logic bug deep in my code, and those are the hardest to track down...
No, they're not. On the contrary. Logical bugs are easily diagnosed by printing
out relevant values
On Wed, 19 May 2010 01:23:55 +1000
Steven D'Aprano wrote:
> On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
> > ples help me figure out what is wrong with this syntax?
> >
> >
> > print('Here are the numbers from 0 to 9')
> > for i in the range(10):
> > print(i)
> >
> > thank you.
>
> O
On Tue, 18 May 2010 14:53:45 +0100
Dipo Elegbede wrote:
> I AM CURRENTLY LEARNING WITH PYTHON 3.0
> just about now, you are all blowing my minds.
> this is great.
Please don't write your replies on top. Write them instead just after the
part(s) of the message you're replying to; and delete the
On Fri, 14 May 2010 06:49:59 +0200
Jan Jansen wrote:
> Hi there,
>
> I'm working on a code to read and write large amounts of binary data
> according to a given specification. In the specification there are a lot
> of "segments" defined. The segments in turn have defintions of datatypes
> and
On Wed, 12 May 2010 13:44:30 -0600
Spencer Parker wrote:
> I have a search and replace script that I am having the user put in the
> directory path as raw_input. The problem lies when I run the script it
> doesn't pick that up for some reason. Is there an appropriate way to take a
> directory p
On Wed, 12 May 2010 13:33:46 +0100
"Ben Millane" wrote:
> Ok first off here is a link to my code
>
> http://pastie.org/956909
>
> My problem is, that although I have the program working how I want it to work
> in general. I still have an issue with the user input section. If my user
> inputs
On Wed, 12 May 2010 16:12:55 +0200
"M. Bashir Al-Noimi" wrote:
> Hi
>
> On 12/05/2010 02:52 م, spir ☣ wrote:
> > On Wed, 12 May 2010 15:01:09 +0200
> > "M. Bashir Al-Noimi" wrote:
> >
> >
> >> humm, you confused me I'm stil
On Wed, 12 May 2010 15:01:09 +0200
"M. Bashir Al-Noimi" wrote:
> humm, you confused me I'm still a newbie and I don't know anything about
> differences between C++ & python even I couldn't understand you. How C++
> is a static language !??!!
Have a look at:
http://en.wikipedia.org/wiki/Dynamic
Hello,
Python objects are supposed to be mainly a structure composed of a (pointer to
a) type and a (pointer to a) value; and to be more or less implemented that way
in the C version.
When an object is of a standard type like a number, the value field would then
point to a C value, or rather
On Wed, 12 May 2010 13:09:05 +0200
"M. Bashir Al-Noimi" wrote:
> Hi All,
>
> This is my first post and I want to set a plan for learning python
> syntax within 2 weeks.
>
> I'm C++/Qt desktop developer and I want to learn python for creating
> rapid web applications so I read some articles ab
On Wed, 12 May 2010 20:12:29 +1000
Steven D'Aprano wrote:
> On Wed, 12 May 2010 03:35:27 pm Luke Paireepinart wrote:
> > I'd have rather you top-posted, then I wouldn't have wasted 30
> > seconds scrolling past a bunch of irrelevant crap that I just gloss
> > over anyway.
> > If I want context I'
On Wed, 12 May 2010 00:35:27 -0500
Luke Paireepinart wrote:
> I'd have rather you top-posted, then I wouldn't have wasted 30 seconds
> scrolling past a bunch of irrelevant crap that I just gloss over
> anyway.
> If I want context I'll read the previous messages in the thread.
> but that's just MH
On Tue, 11 May 2010 11:00:20 -0700
ramya natarajan wrote:
> Hello,
>
> I am very beginner to programming, I got task to Write a loop that reads
> each line of a file and counts the number of lines that are read until the
> total length of the lines is 1,000 characters. I have to read lines fro
On Sun, 9 May 2010 13:43:50 +1000
Steven D'Aprano wrote:
> Here's a counter-opinion:
>
> Dive Into Python must die!
> http://oppugn.us/posts/1272050135.html
I 100% share the article author's opinion. This "book" was surely crafted with
the only intention to disgust anybody of programming. A sh
On Sun, 9 May 2010 19:33:51 +0200
Jan Jansen wrote:
> Hello,
>
> I've got some trouble reading binary files with struct.unpack on windows.
> According to the documentation of the binary file's content, at the
> beginning there're some simple bytes (labeled as 'UChar: 8-bit unsigned
> byte'). Wit
On Sun, 9 May 2010 13:43:50 +1000
Steven D'Aprano wrote:
> http://inventwithpython.com
Yep, this one is great!
(I gave it a nickname: "play programming!" Is this correct english?)
Denis
vit esse estrany ☣
spir.wikidot.com
__
On Thu, 6 May 2010 22:15:34 +0100
"Alan Gauld" wrote:
> As others have pointed out you are returning a reference not a value.
Yes. (I have said that, too.) But still there is a mystery for me. Better
explained byt the following:
x = 0 ; print id(x) # an address
def f() : print x # 0
On Thu, 06 May 2010 16:53:07 -0300
Ricardo Aráoz wrote:
> So you see, your functions just return the value of x. That's because
> the lambda have no parameter, so x refers to the global name x.
In other words, the "upvalue" (the variable captured in the closure) is
referenced. Meaning if you la
On Mon, 03 May 2010 13:08:18 +0200
Stefan Behnel wrote:
> > Why aren't strings mutable, or lists immutable?
>
> What would be the use case of an immutable list, as opposed to a tuple? How
> would you use mutable strings in a dictionary?
[I'm not totally sure of the following, take it with so
On Mon, 03 May 2010 10:55:11 +0200
Stefan Behnel wrote:
> Luke Paireepinart, 03.05.2010 10:27:
> > On Mon, May 3, 2010 at 1:49 AM, Stefan Behnel wrote:
> >> line = line.split('%', 1)[0]
> >
> > lines = [line[:line.index('%')] for line in ...
>
> Agreed that
>
> line = line[
On Mon, 3 May 2010 00:58:14 +0100
"Alan Gauld" wrote:
>
> "spir ☣" wrote
>
> > ...When writing "size = size + new_allocated" instead of
> > "size = new_allocated", It get a growth pattern of:
> >0 3 6 9 16 24 33 43 5
On Mon, 3 May 2010 00:50:40 +1000
Steven D'Aprano wrote:
> On Sun, 2 May 2010 07:44:22 pm Lie Ryan wrote:
>
> > Python's 'list' is an array of pointers to `PyObject` ('object' in
> > Python) and the resizing algorithm keeps the list size such that
> > "allocated / 2 <= actual <= allocated". When
On Sun, 2 May 2010 18:57:41 +1000
Steven D'Aprano wrote:
> On Sun, 2 May 2010 03:49:02 pm spir ☣ wrote:
> > Hello,
> >
> > Is there anywhere some introduction material to the implementation of
> > python lists (or to fully dynamic and flexible sequences, in
> &
On Sun, 02 May 2010 19:44:22 +1000
Lie Ryan wrote:
> On 05/02/10 15:49, spir ☣ wrote:
> > Hello,
> >
> > Is there anywhere some introduction material to the implementation of
> > python lists
> > (or to fully dynamic and flexible sequences, in general)?
>
Hello,
Is there anywhere some introduction material to the implementation of python
lists (or to fully dynamic and flexible sequences, in general)?
More precisely, I'd like to know what kind of base data-structure is used
(linked list, dynamic array, something else -- and in case of array, how i
On Thu, 29 Apr 2010 13:04:20 +0100
"Alan Gauld" wrote:
> IDLE?
> The IDE that comes with Python ias wtten in Python and the
> source comes as part of the standard library.
There's also a free software programming editor --editra, I guess-- written in
and mainly for python. (But I would not re
On Wed, 28 Apr 2010 07:53:06 +0100
Walter Wefft wrote:
> Steven D'Aprano wrote:
> > And for guru-level mastery, replace to call to dict.__init__ with ...
> nothing at all, because dict.__init__ doesn't do anything.
> >
> >
> >
>
> (Sorry, should have sent to list).
>
> I don't understand t
On Tue, 20 Apr 2010 19:11:24 -0700 (PDT)
Lowell Tackett wrote:
> > >>> round(18.15*100) == 1815
> > True
>
> Interestingly, this is the [above] result when I tried entered the same
> snippet:
>
> Python 2.5.1 (r251:54863, Oct 14 2007, 12:51:35)
> [GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)]
On Tue, 20 Apr 2010 14:45:50 -0400
Dave Angel wrote:
> If all values are made up of degrees/minutes/seconds, and seconds is a
> whole number, then store values as num-seconds, and do all arithmetic on
> those values. Only convert them back to deg/min/sec upon output.
This seems the most dire
On Tue, 20 Apr 2010 09:58:06 -0700 (PDT)
Lowell Tackett wrote:
> I'm running headlong into the dilemma of binary math representation, with
> game-ending consequences, e.g.:
>
> >>> 0.15
> 0.14999
> [...]
> The last line should be zero, and needs to be for me to continue this
> algo
On Mon, 19 Apr 2010 00:37:11 +0100
C M Caine wrote:
> That's two new things I've learnt. I didn't realise that for loops
> could be used like that (with more than one... key?).
Consider considering things differently: a for loop always iterates over items
of a collection you indicate:
l = [1,2
On Sun, 18 Apr 2010 13:42:46 -0400
Damon Timm wrote:
> Hi Alan, et al - thanks for your response and your ideas. I sat down
> and did a little more coding so that I might tackle what I can and
> bring back where I am having trouble. I have implemented the basic
> 'tag_map' you suggested without
On Sat, 17 Apr 2010 11:57:28 -0400
Damon Timm wrote:
> Hello - I am writing a script that converts an entire music library
> into a single desired output format. The source music library has a
> variety of music filetypes (flac, mp3, m4a, ogg, etc) and I am
> attempting to use mutagen (a music f
On Thu, 15 Apr 2010 21:03:52 -0500
Tim Goddard wrote:
> I came across a situation where what I thought I wanted to do was to create
> a class that was spawned from data in a .csv file. Where column 1 was the
> name I wanted to use for each instance. I had it all figured out and
> working except
Hello,
I have been recently thinking at lexical distinctions around the notion of
data. (--> eg for a starting point http://c2.com/cgi/wiki?WhatIsData) Not only
but especially in Python. I ended up with the following questions:
Can one state "in Python value=data=object"?
Can one state "in Pytho
On Mon, 12 Apr 2010 00:12:59 -0500
Juan Jose Del Toro wrote:
> Dear List;
>
> I have embarked myself into learning Python, I have no programming
> background other than some Shell scripts and modifying some programs in
> Basic and PHP, but now I want to be able to program.
>
> I have been readi
On Tue, 30 Mar 2010 10:27:43 -0400
Damon Timm wrote:
> As a self-taught Python user I am still looking for insight on the
> most pythonic and programmatically-friendly way of accomplishing a
> given task. In this case, I have written a script that will perform a
> “clean bzip2″ of a directory (or
On Sun, 28 Mar 2010 21:50:46 +1100
Steven D'Aprano wrote:
> On Sun, 28 Mar 2010 08:31:57 pm spir ☣ wrote:
> > Hello,
> >
> > I have a main module importing other modules and defining a top-level
> > variable, call it 'w' [1]. I naively thought that
On Sun, 28 Mar 2010 10:26:43 +0100
AG wrote:
> Modulok wrote:
> > Could you further define 'modeling' in context?
[...]
> The modelling I was referring to is not about 3-D design, but about
> scenario modelling. For example, to understand the impacts of climate
> change on particular bodies o
Hello,
I have a main module importing other modules and defining a top-level variable,
call it 'w' [1]. I naively thought that the code from an imported module, when
called from main, would know about w, but I have name errors. The initial trial
looks as follows (this is just a sketch, the orig
Hello,
I'm writing a kind of language simulation. Here, an expression like "a#3.b"
maps to a NamedData node, with an attribute terms=[('.','a'),('#',3),('.'''b')].
(The lang uses '#' instead of "[...]" for item indexing.)
When this node is "run", the source code maps to a name lookup operation i
Hello,
I was looking for a way to get info about func definition, esp. its param list.
The aim beeing to reproduce more or less its header line.
Found useful hints at
http://stackoverflow.com/questions/582056/getting-list-of-parameters-inside-python-function.
Example:
=
On Mon, 22 Mar 2010 22:31:58 +
laura castañeda wrote:
>
> Hi my name is Laura and im currently trying to solve one of the
> challenges in the book: "Python Programming, second edition" by Michael
> Dawson... I'm stuck in the 5 chapter because of this challenge, im the
> kinda person who dont
48 matches
Mail list logo