]: 46
#works asexpected so far, now let's have a look into t.__dict__
In [6]: t.__dict__
Out[6]: {'a': 23}
-> b does not show up.
Could anyone please explain me why this does not work / how to get b
into .__dict__ / hint me to an explanation?
Thanks a lot in advance!
Cheers
On Dec 16, 10:03 am, Steven D'Aprano wrote:
> On Fri, 16 Dec 2011 00:52:11 -0800, Ulrich wrote:
> > Good morning,
>
> > I wonder if someone could please help me out with the @property function
> > as illustrated in the following example.
>
> >
On Dec 16, 10:11 am, Ulrich wrote:
> On Dec 16, 10:03 am, Steven D'Aprano
>
>
>
>
>
>
>
>
> +comp.lang.pyt...@pearwood.info> wrote:
> > On Fri, 16 Dec 2011 00:52:11 -0800, Ulrich wrote:
> > > Good morning,
>
> > > I wonder if some
t2.b
Isn't there a name for the interactive namespace (like here the
utest2), which I can use to access the variable without handing the
whole dictionary?
Cheers,
Ulrich
--
http://mail.python.org/mailman/listinfo/python-list
Thanks a lot to all!
Apart from obtaining the solution I was searching for, I learned a lot
by studying your answers!
Cheers,
Ulrich
--
http://mail.python.org/mailman/listinfo/python-list
Am 16.05.2013 02:00, schrieb alex23:
My favourite is this one:
http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python
Not only is this blog entry an interesting piece of art, there's other
interesting things to read there, too.
Thanks!
Uli
--
http://mail.python.org/m
Am 22.05.2013 17:32, schrieb Charles Smith:
I'd like to subclass from unittest.TestCase. I observed something
interesting and wonder if anyone can explain what's going on... some
subclasses create null tests.
I can perhaps guess what's going on, though Terry is right: Your
question isn't ver
Am 26.05.2013 21:10, schrieb Daniel Gagliardi:
I want to know how to implement concurrent threads in Python
Have you tried searching the web or maybe looked on docs.python.org?
Seriously, show at least some effort before asking here.
Uli
--
http://mail.python.org/mailman/listinfo/python-lis
Am 10.06.2013 10:29, schrieb Νικόλαος Κούρας:
for key in sorted( months.values() ):
^^^ ^^
KeyError 1 ??!! All i did was to tell python to sort the dictionary values,
which are just integers.
...and which you then proceed to use as key, which is obviously wrong.
Am 10.06.2013 10:04, schrieb Νικόλαος Κούρας:
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4,
'Μάϊος':5, 'Ιούνιος':6, \
'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10,
'Νοέμβριος':11, 'Δεκέμβριος':12 }
for key in sorted( months.keys() ):
=
Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας:
>Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich
Eckhardt έγραψε:
for key in sorted( months.keys() ):
print('''
%s
''' % (months[key], key) )
this in fact wor
Am 10.06.2013 11:48, schrieb Νικόλαος Κούρας:
After many tried this did the job:
for key in sorted(months.items(),key=lambda num : num[1]):
print('''
%s
''' % (key[1], key[0]) )
This code is still sending a misleading message. What you are referring
to as "ke
Am 10.06.2013 15:37, schrieb Νικόλαος Κούρας:
Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt
έγραψε:
Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας:
Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich
Eckhardt έγραψε:
for key in sorted
Am 11.06.2013 12:38, schrieb Νικόλαος Κούρας:
File "/home/nikos/public_html/cgi-bin/metrites.py", line 28, in ,
referer: http://xxxredactedxxx/
page = page.replace( '/home/nikos/public_html/', '' ), referer:
http://xxxredactedxxx/
AttributeError: 'list' object has no attribute 'replace', ref
Am 12.06.2013 13:23, schrieb Νικόλαος Κούρας:
So, how many bytes does UTF-8 stored for codepoints > 127 ?
What has your research turned up? I personally consider it lazy and
respectless to get lots of pointers that you could use for further
research and ask for more info before you even follo
Am 18.06.2013 12:24, schrieb Aditya Avinash:
Hi. This is the last place where I want to ask a question.
You are probably not saying what you mean here. The meaning of your
sentence is more like "Here is the forum that I dislike more than any
other forum, but still I have to ask a question her
Am 04.07.2013 10:37, schrieb Νίκος:
I just started to have this error without changing nothing
Well, undo the nothing that you didn't change. ;)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0:
invalid start byte
[Thu Jul 04 11:35:14 2013] [error] [client 108.162.229.97
Am 04.07.2013 12:38, schrieb Νίκος:
Στις 4/7/2013 12:50 μμ, ο/η Ulrich Eckhardt έγραψε:
Am 04.07.2013 10:37, schrieb Νίκος:
Why cant it decode the starting byte? what starting byte is that?
It's the 0xb6 but it's expecting the starting byte of a UTF-8 sequence.
Please do some resea
Am 09.07.2013 11:39, schrieb loial:
I have a socket application that is connecting to a HP printer via port 9100.
Occassionally I get a "Connection reset by peer" error which I am
trapping and exiting the script with an error message.
Strange. Why does the remote terminate the connection?
T
Welcome to Python!
Am 11.07.2013 11:09, schrieb fronag...@gmail.com:
I'm looking to write a program in Python, (and have in fact written
most of it by now,) and am trying to put together a GUI for it. Kivy
looks very nice, particularly with the fact that it's supposed to be
compatible with most
Hello!
I just stumbled over a case where Python (2.7 and 3.3 on MS Windows)
fail to detect that an object is a function, using the callable()
builtin function. Investigating, I found out that the object was indeed
not callable, but in a way that was very unexpected to me:
class X:
Am 11.07.2013 16:11, schrieb Peter Otten:
Ulrich Eckhardt wrote:
Bug or feature?
No bug. Missing feature if you come up with a convincing use-case.
class Parser:
def _handle_bool(input):
# ...
pass
types = {'bool': _handle_bool,
'boolean
Am 30.07.2013 01:34, schrieb Devyn Collier Johnson:
Typing "101 & 010" or "x = (int(101, 2) & int(010, 2))" only gives errors.
What errors? Check out Eric Raymond's essay on asking smart questions,
it's a real eye-opener! ;)
That said, use "0b" as prefix for binary number literals (0b1000 is
Am 30.07.2013 16:49, schrieb cool1...@gmail.com:
Hello, I am looking for a script that will be able to search an
online document (by giving the script the URL) and find all the
downloadable links in the document and then download them
automatically.
Well, that's actually pretty simple. Using th
Am 13.07.2012 12:09, schrieb Jean-Michel Pichavant:
I have an App object with the 'target' attribute. This target is
controlling a piece of hardware. The hardware itself holds a software,
hence the target object having an 'api' attribute. I hope I make sense.
So basically I'd like
self.target.a
Am 16.07.2012 03:57, schrieb hamilton:
OK then, let me ask, how do you guys learn/understand large projects ?
1. Use the program. This gives you an idea what features are there and a
bit how it could be structured.
2. Build the program, to see what is done to get the program running.
This sho
Welcome!
Am 17.07.2012 10:45, schrieb Lipska the Kat:
I was expecting (hoping) to see in depth documentation relating to Class
construction, extension mechanisms and runtime polymorphism.
In addition to this forum for direct help and discussion, two
suggestions: Firstly, it could help if you
Am 17.07.2012 11:06, schrieb andrea crotti:
import unittest
class TestWithRaises(unittest.TestCase):
def test_first(self):
assert False
def test_second(self):
print("also called")
assert True
if __name__ == '__main__':
unittest.main()
in this case als
Am 17.07.2012 13:01, schrieb Lipska the Kat:
On 17/07/12 10:30, Ulrich Eckhardt wrote:
Am 17.07.2012 10:45, schrieb Lipska the Kat:
I was expecting (hoping) to see in depth documentation relating to Class
construction, extension mechanisms and runtime polymorphism.
In addition to this forum
Am 18.07.2012 11:06, schrieb Lipska the Kat:
On 18/07/12 01:46, Andrew Cooper wrote:
Take for example a Linux system call handler. The general form looks a
little like (substituting C for python style pseudocode)
if not (you are permitted to do this):
return -EPERM
if not (you've given me
There is one model that has helped me much understanding how Python
ticks and that is the model of name tags. The code "a = 1" creates an
integer with value 1 and attaches a tag with "a" written on it using a
small piece of rope. Now, if you attach the tag to a different item, it
obviously does
Am 24.07.2012 10:24, schrieb Chris Angelico:
On Tue, Jul 24, 2012 at 5:47 PM, Ulrich Eckhardt
wrote:
There is one model that has helped me much understanding how Python ticks
and that is the model of name tags. The code "a = 1" creates an integer with
value 1 and attaches a t
Am 24.07.2012 17:01, schrieb cpppw...@gmail.com:
reader = codecs.getreader(encoding)
lines = []
with open(filename, 'rb') as f:
lines = reader(f, 'strict').readlines(keepends=False)
where encoding == 'utf-16-be'
Everything works fine, except that lines[0] is equal to c
Hi!
I just had an idea, it occurred to me that the pass statement is pretty
similar to the print statement, and similarly to the print() function,
there could be a pass() function that does and returns nothing.
Example:
def pass():
return
try:
do_something()
except:
Am 25.07.2012 18:05, schrieb Chris Angelico:
By comparison, Python 2's print statement is executable. It causes
real action to happen at run-time. It makes sense to pass "print" as
an argument to something; for instance:
def some_generator():
yield blah
map(print,some_generator())
Simple w
hat want it? Seriously, Steven, as much as
I like your regular contributions here, this time you had better logged
off and taken a walk, because you come across as _very_ arrogant here.
But of course I could be wrong. Ulrich, if you are still reading this, if
you have good examples for how pas
Am 26.07.2012 07:20, schrieb Michael Hrivnak:
If we want pass(), then why not break() and continue()? And also
def() and class()? for(), while(), if(), with(), we can make them all
callable objects!
Except that they are control statements. They are not objects, they
have no type, and they can
Am 26.07.2012 11:26, schrieb Steven D'Aprano:
On Thu, 26 Jul 2012 08:59:30 +0200, Ulrich Eckhardt wrote:
Am 26.07.2012 04:38, schrieb Steven D'Aprano:
(Actually, I reckon that what is driving this idea is that the OP is a
beginner, and he's got a syntax error a few times fro
Am 26.07.2012 09:50, schrieb Mark Lawrence:
And if we could persuade the BDFL to introduce braces, we could have {()
and }()
What do you mean "persuade"? Braces work perfectly:
def foo():
{}
Uli
--
http://mail.python.org/mailman/listinfo/python-list
Am 30.07.2012 02:44, schrieb Steven D'Aprano:
I wish to extract the bit fields from a Python float, call it x. First I
cast the float to 8-bytes:
s = struct.pack('=d', x)
i = struct.unpack('=q', s)[0]
Then I extract the bit fields from the int, e.g. to grab the sign bit:
(i & 0x800
Hi!
Using Python 2.7, I stumbled across the fact that 'self.xy' raises an
AttributeError if self doesn't have an 'xy' as attribute, but 'xy' will
instead raise a NameError. To some extent, these two are very similar,
namely that the name 'xy' couldn't be resolved in a certain context, but
the
Am 01.08.2012 19:57, schrieb Laszlo Nagy:
## Open file
lock = threading.Lock()
fin = gzip.open(file_path...)
# Now you can share the file object between threads.
# and do this inside any thread:
## data needed. block until the file object becomes usable.
with lock:
data = fin.read() # o
Hi!
I'm trying to write some code that should work with both Python 2 and 3.
One of the problems there is that the input() function has different
meanings, I just need the raw_input() behaviour of Python 2.
My approach is to simply do this:
try:
# redirect input() to raw_input() lik
Am 03.08.2012 13:49, schrieb Subhabrata:
I am trying to call the values of one function in the
> another function in the following way:
def func1():
num1=10
num2=20
print "The Second Number is:",num2
return
def func2():
num3=num1+num2
num4=num3+
Am 04.08.2012 15:53, schrieb Stefan Behnel:
So, if a C++ compiler takes a .c file and compiles it with C language
semantics, it doesn't qualify as a C compiler? That implies a rather weird
definition of a C compiler, I'd say.
I'd say that even a brainfuck compiler compiling a .py file with C
l
Am 10.08.2012 15:01, schrieb loial:
I am writing an application to send data to a printer port(9100) and
then recieve PJL responses back on that port. Because of the way PJL
works I have to do both in the same process(script).
If I understand that right, you are opening a TCP connection, so
ob
Am 16.08.2012 09:17, schrieb Johan van Zyl:
I installed Python 3.2.3 successfully on my work laptop (XP) but
cannot seem to do it on my home PC (Win7)
I click the button to install and the window just disappears o the screen.
So how do I in fact install Python 3.2.3 on Win 7?
I used some MSI fi
I that Outlook & Co are guilty. That and the fact that few people even
think about this. Even today that makes sense, because it provides an
exact context. Without that, you wouldn't be able to really understand
what exactly a person is referring to. Also, it helps people to
structure their tho
Am 17.08.2012 03:01, schrieb Paul Rubin:
Ian Kelly writes:
With regard to key insertion and deletion while iterating over a dict
or set, though, there is just no good reason to be doing that
(especially as the result is very implementation-specific), and I
wouldn't mind a more complete low-leve
Am 21.08.2012 00:49, schrieb Prasad, Ramit:
I also tend to blame M$ (Outlook and variants) for this tendency to
quote everything and top-post -- Outlook makes it almost impossible
to do a trim&interleave response style.
I [think] that Outlook & Co are guilty. That and the fact that few
people e
Am 21.08.2012 10:38, schrieb namenobodywa...@gmail.com:
what is the best way
Define "best" before asking such questions. ;)
using color/shading on a tkinter canvas as a visualization for a
two-dimensional grid of numbers? so far my best idea is to use the
same value for R,G and B (fill = '#x
Am 21.08.2012 19:07, schrieb DJC:
On 21/08/12 12:55, Ulrich Eckhardt wrote:
Am 21.08.2012 10:38, schrieb namenobodywa...@gmail.com:
what is the best way
Define "best" before asking such questions. ;)
<http://matplotlib.sourceforge.net/api/colors_api.html?highlight=colors#matp
Am 27.08.2012 03:23, schrieb bruceg113...@gmail.com:
My program uses Python 2.6 and Sqlite3 and connects to a network
database 100 miles away.
Wait, isn't SQLite completely file-based? In that case, SQLite accesses
a file, which in turn is stored on a remote filesystem. This means that
there a
Am 29.08.2012 17:04, schrieb Franck Ditter:
I use Python 3.2.3 + Idle.
Is it possible to program test(e) which takes
an expression e and whose execution produces
at the toplevel an echo of e and the effects
and result of its evaluation ?
Yes, the key to this is using a lambda expression.
# f
Am 30.08.2012 12:55, schrieb 陈伟:
class A(object):
d = 'it is a doc.'
t = A()
print t.__class__.d
print t.d
the output is same.
You could go even further:
print id(t.__class__.d)
print id(t.d)
which should show you that they are not just equal but identical.
so it means class object
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
s = os.stat(".")
print s
posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, st_u
id=1000, st_gid=100, st_size=4096L, st_atime=1346327745, st_mtime=1346327754, st
_ctime=1346327754)
What sort of object is posix.stat_r
Am 30.08.2012 15:27, schrieb Marco Nawijn:
On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote:
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
What sort of object is posix.stat_result?
[...]
I guess that this is a named tuple, which is a tuple where the
attributes are
Am 06.09.2012 17:07, schrieb Helpful person:
I am a complete novice to Python.
Welcome!
I wish to access a dll that has
been written to be compatible with C and VB6. I have been told that
after running Python I should enter "from ctypes import *" which
allows Python to recognize the dll str
Am 13.09.2012 10:47, schrieb 钟驰宇:
I'm in ubuntu10.04 and I decide to compile python2.7 from source
[...] However when I run my GAE app,it comes out with no module
named _ssl and _sqlite3.
There are Debian-specific ways to ease this task that should work in
Ubuntu, too. First is "apt-get build-d
Am 13.09.2012 14:51, schrieb andrea crotti:
I am in a situation where I have a class Obj which contains many
attributes, and also contains logically another object of class
Dependent.
This dependent_object, however, also needs to access many fields of the
original class, so at the moment we did
Am 14.09.2012 11:28, schrieb Jean-Michel Pichavant:
Decorators are very popular so I kinda already know that the
fault is mine. Now to the reason why I have troubles writing
them, I don't know. Every time I did use decorators, I spent
way too much time writing it (and debugging it).
I wrote the
Am 21.09.2012 00:58, schrieb thorso...@lavabit.com:
list = [{'1': []}, {'2': []}, {'3': ['4', '5']}]
I want to check for a value (e.g. '4'), and get the key of the dictionary
that contains that value.
Note:
1. list is a built-in type, who's name is rebound above
2. The list above contains dict
Am 24.09.2012 23:49, schrieb Dave Angel:
And what approach would you use for positioning relative to
end-of-file? That's currently done with an optional second
> parameter to seek() method.
Negative indices.
;)
Uli
--
http://mail.python.org/mailman/listinfo/python-list
Am 25.09.2012 16:11, schrieb alex23:
On Sep 26, 12:08 am, Peter Otten <__pete...@web.de> wrote:
Jayden wrote:
In the Python Tutorial, Section 9.4, it is said that
"Data attributes override method attributes with the same name."
The tutorial is wrong here. That should be
"Instance attribut
Am 01.10.2012 02:11, schrieb Jason Friedman:
$ crontab -l
* * * * * env
This produces mail with the following contents:
[...]
SHELL=/bin/sh
^^^
[...]
On the other hand
$ env
produces about 100 entries, most of which are provided by my .bashrc;
bash != sh
Instead of running
Greetings!
I'm trying to unittest a class hierachy using Python 2.7. I have a
common baseclass Base and derived classes D1 and D2 that I want to test.
The baseclass in not instantiatable on its own. Now, the first approach
is to have test cases TestD1 and TestD2, both derived from class TestCa
Am 02.10.2012 16:06, schrieb Thomas Bach:
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
As you see, the code for test_base() is redundant, so the idea is to
move it to a baseclass:
class TestBase(unittest.TestCase):
def test_base(self):
...
class TestD1
Am 02.10.2012 16:06, schrieb Thomas Bach:
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
As you see, the code for test_base() is redundant, so the idea is to
move it to a baseclass:
class TestBase(unittest.TestCase):
def test_base(self):
...
class TestD1
Am 05.10.2012 10:51, schrieb Luca Sanna:
the code is output the error of the ubuntu
from bluetooth import *
[...]
nearby_devices = discover_devices()
[...]
the error
luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py
Traceback (most recent call last):
File "blue
Am 08.10.2012 16:07, schrieb iMath:
To get the accurate value of 1 - 0.999 ,how to implement the python
algorithm ?
Algorithms are generally language-agnostic, so what is your question
BTW ,Windows’s calculator get the accurate value ,anyone who knows how to
implement it ?
You
Am 09.10.2012 13:59, schrieb arg...@gmail.com:
below is the text file i have How to create Facility as a key and then assign
multiple values to it
The value part of a dict element can be any kind of object, like e.g. a
tuple, namedtuple or even a dict.
Uli
--
http://mail.python.org/mailma
Am 09.10.2012 16:02, schrieb loial:
I am trying to match a string that containing the "<" and ">"
characters, using the string contains function, but it never seems to
find the lines containing the string
e.g if mystring.contains("") :
I can't locate a 'contains' function anywhere, what type i
Am 09.10.2012 18:00, schrieb Jean-Michel Pichavant:
I'm trying to generate C++ code from an XML file. I'd like to use a
template engine, which imo produce something readable and
maintainable.
[...]
Here's my flow:
XML file -> nice python app -> C++ code
There is one question that you should an
Am 10.10.2012 02:32, schrieb Wenhua Zhao:
I just noticed that in /usr/lib/python2.7/threading.py
class _Condition(_Verbose):
...
def _is_owned(self):
# Return True if lock is owned by current_thread.
# This method is called only if __lock doesn't have
# _is_o
Am 10.10.2012 03:16, schrieb MRAB:
On 2012-10-10 01:32, Wenhua Zhao wrote:
Hi list,
I just noticed that in /usr/lib/python2.7/threading.py
class _Condition(_Verbose):
...
def _is_owned(self):
# Return True if lock is owned by current_thread.
# This method is called
Am 12.10.2012 00:06, schrieb Wenhua Zhao:
On Wed, Oct 10, 2012 at 12:21 PM, Ian Kelly wrote:
Can you demonstrate an API bug that is caused by this?
A simple demo of this error is:
[...]
print "in main cv._is_owned: ", cv._is_owned()
That is kind of cheating, because as far as I can t
Hi!
I need a little nudge in the right direction, as I'm misunderstanding
something concerning string literals in Python 2 and 3. In Python 2.7,
b'' and '' are byte strings, while u'' is a unicode literal. In Python
3.2, b'' is a byte string and '' is a unicode literal, while u'' is a
syntax
Hi!
I noticed yesterday that a single HTTP request to localhost takes
roughly 1s, regardless of the actually served data, which is way too
long. After some digging, I found that the problem lies in
socket.create_connection(), which first tries the IPv6 ::1 and only then
tries the IPv4 127.0.0
Some updates on the issue:
The etc/hosts file contains the following lines:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
As I understand it, those effectively mean that localhost is not
resolved via this hosts fil
Hi!
General advise when assembling strings is to not concatenate them
repeatedly but instead use string's join() function, because it avoids
repeated reallocations and is at least as expressive as any alternative.
What I have now is a case where I'm assembling lines of text for driving
a pro
Am 29.10.2012 00:30, schrieb goldtech:
class Contact:
all_contacts = []
def __init__(self, name, email):
self.name = name
self.email = email
Contact.all_contacts.append(self)
Okay, a class that automatically registers all instances in a central list.
OK,
Hi!
I can call a staticmethod f() of class C like "C.f()" or with an
instance like "C().f()". Inside that staticmethod, I have neither the
class (at least not the original one) nor do I have an instance, so I
can't call a different staticmethod from the same class. The obvious
solution is to
Am 30.10.2012 14:47, schrieb Dave Angel:
I'd think the obvious solution is to move both the functions outside of
the class. I haven't figured out the justification for staticmethod,
except for java or C++ converts.
Although I come from a C++ background, I think static functions have
solid rea
Am 30.10.2012 18:23, schrieb Jean-Michel Pichavant:
- Original Message -
[snip]
I haven't figured out the justification for staticmethod,
http://en.wikipedia.org/wiki/Namespace
+
"Namespaces are one honking great idea -- let's do more of those!"
Someone may successfully use only modul
Am 02.11.2012 09:08, schrieb Martin Hewitson:
On 2, Nov, 2012, at 08:38 AM, Paul Rubin
wrote:
Martin Hewitson writes:
So, is there a way to put these methods in their own files and
have them 'included' in the class somehow? ... Is there an
official python way to do this? I don't like having s
Am 02.11.2012 09:20, schrieb Martin Hewitson:
Well, here we disagree. Suppose I have a class which encapsulates
time-series data. Below is a list of the absolute minimum methods one
would have to process that data.
[...]
> 'abs' 'acos' 'asin' 'atan' 'atan2' 'average' 'cohere' 'conv' 'corr'
> 'co
Am 02.11.2012 12:20, schrieb Jason Benjamin:
Anybody know of the appropriate place to troll and flame about various
Python related issues? I'm kind of mad about some Python stuff and I
need a place to vent where people may or may not listen, but at at least
respond. Thought this would be a stra
Hi everybody!
I was just smacked by some very surprising Python 2.7 behaviour. I was
assembling some 2D points into a list:
points = []
points += (3, 5)
points += (4, 6)
What I would have expected is to have [(3, 5), (4, 6)], instead I got [3,
5, 4, 6]. My interpretations thereof is that th
Am 05.11.2012 11:54, schrieb andrea crotti:
Quite often I find convenient to get a filename or a file object as
argument of a function, and do something as below:
def grep_file(regexp, filepath_obj):
"""Check if the given text is found in any of the file lines, take
a path to a file or
Hi!
I have two problems that are related and that I'd like to solve together.
Firstly, I have code that allows either a file or a string representing
its content as parameter. If the parameter is a file, the content is
read from the file. In Python 2, I used "isinstance(p, file)" to
determine
Hi!
Preparing for an upgrade from 2.7 to 3, I stumbled across an
incompatibility between 2.7 and 3.2 on one hand and 3.3 on the other:
class X(int):
def __init__(self, value):
super(X, self).__init__(value)
X(42)
On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeErr
Am 08.11.2012 21:29, schrieb Terry Reedy:
On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
wrote:
On 3.3, it gives me a "TypeError: object.__init__() takes no
parameters". To some extent, this makes sense to me, because the
int subobject is not initialized in __init__ but in __n
Am 09.11.2012 12:37, schrieb Steven D'Aprano:
On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote:
Or, do you suggest I don't call super().__init__()? That would seem
unclean to me.
On the contrary: calling super().__init__ when the superclass does
something you don't wa
Am 11.11.2012 23:24, schrieb Cantabile:
I'm writing a small mail library for my own use, and at the time I'm
testing parameters like this:
Let's ignore the facts that there is an existing mail library, that you
should use real parameters if they are required and that exit() is
completely inap
Am 12.11.2012 14:12, schrieb F.R.:
Once in a while I write simple routine stuff and spend the next few hours
trying to understand why it doesn't behave as I expect. Here is an example
holding me up:
[...snip incomplete code...]
Trying something similar with a simpler class works as expected:
[
Am 09.11.2012 12:37, schrieb Steven D'Aprano:
In Python 3.3:
py> class X(int):
... def __init__(self, *args):
... super().__init__(*args) # does nothing, call it anyway
...
py> x = X(22)
Traceback (most recent call last):
File "", line 1, in
File "", line 3, in __init__
TypeE
Am 14.11.2012 10:51, schrieb Kiran N Mallekoppa:
1. Is this information available somewhere?
2. I was pointed to PEP-11, which documents the platforms that are not
supported. So, can we take that all active versions of Python (2.7.3 and
3.3, i believe) are supported on all the OS flavors that Pyt
Am 15.11.2012 13:29, schrieb chip9m...@gmail.com:
I have a python module, lets call it debugTest.py.
and it contains:
def test():
a=1
b=2
c=a+b
c
so as simple as possible.
Should that be "return c" instead of "c" on a line?
Now I would like to debug it in eclipse.. (I h
Am 16.11.2012 13:06, schrieb chip9munk:
I would like to use conf file to get all the variables in my code. And
it works great. I use the following (simple example):
execfile("example.conf", config)
print config["value1"]
and it works like a charm.
This works, but in general importing con
Am 18.11.2012 12:45, schrieb Chris Angelico:
(if you'll forgive the pun)
Nevarr!
Is IDLE named after Eric of that name, or is it pure coincidence?
Maybe. Interestingly, there is also
http://eric-ide.python-projects.org/, just to add some more unfounded
conspiracy theories to this discuss
1 - 100 of 489 matches
Mail list logo