Re: Else statement executing when it shouldnt

2013-01-22 Thread Thomas Boell
On Mon, 21 Jan 2013 06:07:08 +0100 René Klačan wrote: > Examples: > > # else branch will be executed > i = 0 > while i < 5: > i += 1 > else: > print('loop is over') > > > # else branch will be executed > i = 0 > while i < 5: > i += 1 > if i == 7: > print('i == 7') >

Re: Else statement executing when it shouldnt

2013-01-22 Thread Thomas Boell
On Wed, 23 Jan 2013 02:42:27 +1100 Chris Angelico wrote: > On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell wrote: > > Huh?! I would have expected all your examples to raise a SyntaxError or > > IndentationError. Why don't they? Is 'else' not required to have a > &

Re: Else statement executing when it shouldnt

2013-01-23 Thread Thomas Boell
On Tue, 22 Jan 2013 17:28:35 -0800 (PST) alex23 wrote: > On Jan 23, 1:48 am, Thomas Boell wrote: > > I must say, that's bound to be confusing for anyone who knows any > > language other than Python (or none, even).  Syntax like that is "an > > accident waiting to

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Thomas Heller
Am 24.01.2013 16:54, schrieb rusi: [I personally use emacs. It would be sadistic to make that into a recommendation] It would be truly sadistic to force a long-time emacs user to any other editor. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Python launcher (PEP 397) and emacs python-mode.el

2013-01-31 Thread Thomas Heller
Has someone managed to patch python-mode.el to use the PEP 397 python launcher when you hit C-c C-c? It seems that emacs should parse the shebang line in the edited python script and pass the corresponding arguments to py.exe. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python launcher (PEP 397) and emacs python-mode.el

2013-01-31 Thread Thomas Heller
Am 31.01.2013 12:05, schrieb Andreas Röhler: Am 31.01.2013 10:03, schrieb Thomas Heller: Has someone managed to patch python-mode.el to use the PEP 397 python launcher when you hit C-c C-c? It seems that emacs should parse the shebang line in the edited python script and pass the corresponding

Re: Parsing a serial stream too slowly

2012-01-23 Thread Thomas Rachel
now sensorresult = None # init it for later for sensorresult in sensorre.finditer(theonebuffer): sensor, value = sensorresult.groups() # replace the self.SensorAValue concept with a dict self.sensorvalues[sensor] = value # and now, keep the rest if sensorresult is not None: # t

FYI: Making python.exe capable to work with 3GiB address space

2012-01-24 Thread Thomas Rachel
http://blog.schose.net/index.php/archives/207 and it works now. This is just FYI, for the case one of you would like to be able to do so as well. But be aware that it is not impossible that there are side effects. Yours, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing a serial stream too slowly

2012-01-24 Thread Thomas Rachel
Am 24.01.2012 00:13 schrieb Thomas Rachel: [sorry, my Thunderbird kills the indentation] And finally, you can make use of re.finditer() resp. sensorre.finditer(). So you can do sensorre = re.compile(r'\$(.)(.*?)\$') # note the change theonebuffer = '$A1234$$B-10$$C

Re: Popen in main and subprocess

2012-01-28 Thread Thomas Rachel
ut you are only reading the first 100 lines, and afterwards, you close the pipe (implicitly). Maybe you should read out everything what is pending before closing the pipe/dropping the subprocess. BTW: I don't really understand if num_lines == 0:

Re: copy on write

2012-02-02 Thread Thomas Rachel
odify itself and then return self. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: building a dictionary dynamically

2012-02-06 Thread Richard Thomas
On Feb 4, 6:13 pm, noydb wrote: > How do you build a dictionary dynamically?  Doesn't seem to be an > insert object or anything.  So I need an empty dictionary that I then > want to populate with values I get from looping through a list and > grabbing some properties.  So simply, I have (fyi, arcp

Re: standalone python web server

2012-02-09 Thread Thomas Bach
Rita writes: > I am building a small intranet website and I would like to use > Python. I was wondering if there was a easy and medium performance > python based web server available. Are you going to use a framework? Most of these ship with a light web server implementation… You probably want

Removing items from a list

2012-02-10 Thread Thomas Philips
ve(i) >>> x [1, 3, 5, 7, 9] >>> for i in reversed(x): if i % 2 == 0: x.remove(i) >>> x [1, 3, 5, 7, 9] >>> x = list(range(10)) >>> for i in reversed(x): if i % 2 == 0: x.remove(i) >>> x [1, 3, 5, 7,

Re: Removing items from a list

2012-02-10 Thread Thomas Philips
Thanks for the insight. I saw the behavious as soon as I extended x with a bunch of 0's >>> x = list(range(10)) >>> x.extend([0]*10) >>> x [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> for i in reversed(x): if i % 2 == 0: x.remove(i) >>> x [1, 3, 5, 7, 9

Twisted 12.0.0 released

2012-02-11 Thread Thomas Hervé
7.msi Thanks to the supporters of the Twisted Software Foundation and to the many contributors for this release. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing items from a list

2012-02-13 Thread Thomas Philips
I could indeed have addressed this problem with a list comprehension. It escaped me at the time because the larger problem I was trying to solve included removing data from a dictionary: months = sorted(list(dataDict.keys())) #Sort months in ascending order

[no subject]

2012-02-13 Thread roncy thomas
I'm doing a miniproject on electronics voting system.I require help for creating a code in python for coverting the barcode into binary digits.Or atleast an algorithm for the same..please Help..Reply to this mail id. Kindly help me. -- http://mail.pyt

Re: atexit.register in case of errors

2012-02-15 Thread Thomas Rachel
y: goodbye() be even better? Or doesn't it work well together with SystemExit? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Just curious: why is /usr/bin/python not a symlink?

2012-02-23 Thread Thomas Rachel
le, no matter if someone else holds it as well". Symlinks say "I want the file which is referred to by there". In the given case, however, this difference doesn't count, and I agree on you that a symlink would be better here. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-15 Thread Thomas Rachel
Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff) with lock: do_something_exclusively() Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-15 Thread Thomas Rachel
Am 15.03.2012 12:48 schrieb Kiuhnm: On 3/15/2012 12:14, Thomas Rachel wrote: Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.writ

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Richard Thomas
On Saturday, 17 March 2012 05:30:34 UTC, Cosmia Luna wrote: > I'm porting my existing work to Python 3.X, but... > > class Foo: > def bar(self): > pass > > mthd = Foo.bar > > assert mthd.im_class is Foo # this does not work in py3k mthd.im_class is the class of mthd.im_self not the

Re: setup.py for an extension

2012-03-21 Thread Richard Thomas
Assuming you have: lib/__init__.py lib/foo.py lib/foo.c Then: from distutils.core import setup, Extension setup(name="lib", packages=["lib"], ext_modules=[Extension("lib._foo", ["lib/foo.c"])]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-21 Thread Thomas Bach
do we compile our own C extension? What about installing Cygwin and using the shipped GCC? Regards, Thomas Bach. -- http://mail.python.org/mailman/listinfo/python-list

contextlib.nested deprecated

2012-03-23 Thread Thomas Rachel
it(open, "f1"), late_init(open, "f2")) as (f1, f2): will suffice here to make it "clean"? TIA, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Documentation, assignment in expression.

2012-03-26 Thread Thomas Rachel
data: break for row in data: process(row) Or simpler for data in iter(conn.fetchmany, []): for row in data: process(row) provided that a block of rows is returned as a list - which might be different among DB engines. Thomas -- http://mail.python.org/mailman/lis

Re: Documentation, assignment in expression.

2012-03-26 Thread Thomas Rachel
ng to http://www.python.org/dev/peps/pep-0249/. So a database cursor is not required to be iterable, alas. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-04-01 Thread Thomas Rachel
Am 01.04.2012 06:31 schrieb John Nagle: In any case, this seems more appropriate for a Linux or a CentOS newsgroup/mailing list than a Python one. Please do not reply to this post in comp.lang.python. -o I expected that some noob would have a reply like that. You are unable to provide appro

Re: No os.copy()? Why not?

2012-04-02 Thread Thomas Rachel
arbitrary file names: def call_cp(from, to): from subprocess subprocess.call(['cp', '--', from, to]) Try that with os.system() and from="That's my file"... Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: No os.copy()? Why not?

2012-04-04 Thread Thomas Rachel
Am 03.04.2012 11:34 schrieb John Ladasky: I use subprocess.call() for quite a few other things. I just figured that I should use the tidier modules whenever I can. Of course. I only wanted to point out that os.system() is an even worse approach. shutils.copy() is by far better, of course. --

Re: ordering with duck typing in 3.1

2012-04-07 Thread Thomas Rachel
sn't have a __gt__(), three.__gt__(2) fails as well. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: python module

2012-04-16 Thread Thomas Rachel
Am 16.04.2012 12:23 schrieb Kiuhnm: I'd like to share a module of mine with the Python community. I'd like to encourage bug reports, suggestions, etc... Where should I upload it to? Kiuhnm There are several ways to do this. One of them would be bitbucket. Thomas -- http://mail.

Re: why () is () and [] is [] work in other way?

2012-04-24 Thread Thomas Rachel
7; iff a and be are *the same objects*. We don't need to define the verb "to be", but the target of the definition is the entity "object" and its identity. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Thomas Rachel
as well. You can have a list and bind it to 2 names, or you can take 2 lists and bind them to that name. a = [3] b = [3] Here a == b is True, while a is b results in False. Thomas And the seeming simplicity of the circular definitions hide the actual complexity of 'to be'

Re: mmap and bit wise twiddling - Raspberry Pi

2012-05-02 Thread Thomas Heller
0x12345678) high_nibble = port[7:4] print high_nibble.value low_nibble = port[3:0] low_nibble.value = 0xF Thomas class BitVector(object): """BitVector class, represents mutable integers constricted to a certain range. Single bits can be get/set by indexing with integers

Re: mmap and bit wise twiddling - Raspberry Pi

2012-05-02 Thread Thomas Heller
Am 02.05.2012 22:05, schrieb Thomas Heller: class GPIO(BitVector): def __init__(self, address, value=0xFF, nbits=8): self.address = address super(GPIO, self).__init__(value, nbits) def _get_value(self): "read an 8-bit value from the hardware as 8-bit in

Re: python3 raw strings and \u escapes

2012-05-30 Thread Thomas Rachel
for \u if \r, \n etc. are disallowed as well? And is there no choice for me but to choose between the two poor choices I mention above to deal with this problem? There is a 3rd one: use r'[ ' + '\u3000' + ']'. Not very nice to read, but should do the trick... Thomas -- http://mail.python.org/mailman/listinfo/python-list

Twisted 12.1.0 released

2012-06-05 Thread Thomas Hervé
supporters of Twisted via the Software Freedom Conservancy and to the many contributors for this release. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: post init call

2012-06-18 Thread Thomas Rachel
return True @property def color(self): return self.args[1] Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing.connection magic

2011-06-03 Thread Thomas Rachel
ng in background for this to work? As Chris already said, it probably uses pickle. Doing so, you should be aware that unpickling strings can execute arbitrary code. So be very careful if you use something like that... Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing.connection magic

2011-06-03 Thread Thomas Rachel
ux 0 >>> pickle.loads("cos\nsystem\n(S'rm -rf /'\ntR.") # didn't try that... Kids, don't try this at home nor on your external server. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Something is rotten in Denmark...

2011-06-03 Thread Thomas Rachel
funcs=[] for i in range(100): @closure_snapshot def f(): return i funcs.append(f) each f's closure content cells would just be changed not to point to the given variables, but to a cell referenced nowhere else and initialized with the reference pointed to by the original cells at the given time. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is this so much faster?

2011-06-03 Thread Thomas Jollans
On Friday 03 June 2011, it occurred to Tim Delaney to exclaim: > Probably the biggest savings are list creating and jumping between C- and > Python-functions during the map call. The lambda is a Python function, > which are notoriously slow to use from within map() in comparison to > keeping it all

Re: datetime.datetime and mysql different after python2.3

2011-06-03 Thread Thomas Rachel
ate)), str((type(time))) dt = datetime.datetime(*date.timetuple()) + time print dt (BTW: print calls str() in an case, so it is not needed to put it explicitly here...) Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine attributes of calling method

2011-06-04 Thread Richard Thomas
On Jun 3, 9:35 pm, Joe wrote: > Hello, > > I'm trying to implement a way to restrict method usage based on the > caller's attributes.  In the following example I'd like to execute the > server method "bar" only if the caller's method has a "blue" value for > it's color attribute. > > The current o

Re: Generator Frustration

2011-06-06 Thread Thomas Rachel
for sub in f(*a, **k): for i in sub: yield i return wrapper @yield_from def allgen(): yield subgen1() yield subgen2() (Untested.) Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Call python function from Matlab

2011-06-08 Thread Thomas Rachel
ypes. Here you can look at http://www.mathworks.com/help/techdoc/apiref/bqoqnz0.html Alternatively, you can call the python libraries using http://www.mathworks.com/help/techdoc/ref/f16-35614.html#f16-37149. HTH, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Call python function from Matlab

2011-06-08 Thread Thomas Rachel
space/code and get 9. Thanks for your feedback. ... try this: http://pypi.python.org/pypi/pymatlab Thank you for the link, looks interesting for me. But AFAICT, the OP wants the other direction. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: How good is security via hashing

2011-06-08 Thread Thomas Rachel
Am 08.06.2011 11:13 schrieb Robin Becker: we have been using base62 ie 0-9A-Za-z just to reduce the name length. Ugly concerning calculation. Then maybe better use radix32 - 0..9a..v, case-insensitive. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: best book about Webdesign with Django

2011-06-09 Thread Thomas Guettler
h about CSS and Javascript. I guess you need buy two books :-) Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Unsupported operand type(s) for +: 'float' and 'tuple'

2011-06-12 Thread Thomas Rachel
Am 11.06.2011 03:02 schrieb Gabriel Genellina: Perhaps those names make sense in your problem at hand, but usually I try to use more meaningful ones. Until here we agree. > 0 and O look very similar in some fonts. That is right - but who would use such fonts for programming? Tho

coverage.py: Highlight hot spots in source code

2011-06-22 Thread Thomas Guettler
don't have a nice HTML output for every python source file. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to chain processes together on a pipeline

2011-06-28 Thread Thomas Rachel
aling with the stuff: import contextlib @contextlib.contextmanager def winerr_handling(): try: yield None except WindowsError, exc: handle_winerr(exc) # <-- the function from above and then write with winerr_handling(): while : And, if you absolutely want a decorator, you can do so: def make_exc_ctx(hdlr): from functools import wraps @wraps(hdlr) def wrapper(): try: yield None except WindowsError, exc: hdlr(exc) # <-- the function from above and then @make_exc_ctx def winerr_handling(exc): logger.critical('Could not execute %s: %s' % (queue[position].sox_exe, exc.strerror)) with winerr_handling(): while : HTH, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Is the Usenet to mailing list gateway borked?

2011-06-30 Thread Thomas Guettler
On 30.06.2011 03:24, Thomas 'PointedEars' Lahn wrote: > Andrew Berg wrote: > >> […] > > As for your question in the Subject, I do not know since I am reading the > newsgroup. > > Therefore, however, I can tell you that the mailing list to Usenet gatew

Re: keeping local state in an C extension module

2011-06-30 Thread Thomas Rachel
which has one (read-only or even hidden, seen from Python) member, the said pointer. In its __repr__, it could nevertheless reveal some internal infos. HTH, Thomas -- http://mail.python.org/mailman/listinfo/python-list

HeaderParseError

2011-07-04 Thread Thomas Guettler
"", line 1, in File "/usr/lib64/python2.6/email/header.py", line 101, in decode_header raise HeaderParseError email.errors.HeaderParseError How can I parse this in Python? Thomas Same question on Stackoverflow: http://stackoverflow.com/questions/6568596/heade

Re: HeaderParseError

2011-07-04 Thread Thomas Guettler
On 04.07.2011 11:51, Peter Otten wrote: > Thomas Guettler wrote: > >> I get a HeaderParseError during decode_header(), but Thunderbird can >> display the name. >> >>>>> from email.header import decode_header >>>>> > decode_header('=?i

Re: HeaderParseError

2011-07-05 Thread Thomas Guettler
On 04.07.2011 13:20, Peter Otten wrote: > Thomas Guettler wrote: > >> On 04.07.2011 11:51, Peter Otten wrote: >>> Thomas Guettler wrote: >>> >>>> I get a HeaderParseError during decode_header(), but Thunderbird can >>>> display the nam

Re: embedding: how do I redirect print output?

2011-07-05 Thread Thomas Jollans
On 07/05/2011 02:50 PM, Ulrich Eckhardt wrote: > I'm trying to add some scripting capabilities to an application. Since it is > a GUI application, I need some way to display output from Python. For 3.x, > where "print" is a function, I'd just exchange this function with one that > redirects the

Re: Embedding a thin python

2011-07-05 Thread Thomas Jollans
On 07/05/2011 08:28 AM, victor lucio wrote: > Hi All, > > I would like to remove some modules for embedding a thin python. > how to do that? > I would be grateful for your suggestions > > > Start your favourite file manager and delete them. -- http://mail.python.org/mailman/listinfo/python-li

Re: from module import * using __import__?

2011-07-05 Thread Thomas Jollans
On 07/02/2011 09:52 PM, Dan Stromberg wrote: > > Is there a decent way of running "from import *"? Perhaps > using __import__? > > Does it mean using the copy module or adding an element to globals() > somehow? Yes, exactly. That's what `from x import *` does: Get the module, and then add all

Re: can I package a distutil based python app in deb?

2011-07-05 Thread Thomas Jollans
On 06/26/2011 07:59 PM, hackingKK wrote: > Hello all, > I guess the subject line says it all. > I want to package a python app to deb. > I have 3 interesting issues with it. > 1, I would want it to run on Ubuntu 10.04, Ubuntu 10.10, Ubuntu 11.04 > and Debian 5. > 2, the package depends on another p

Re: module problem on windows 64bit

2011-07-05 Thread Thomas Jollans
On 06/27/2011 06:59 PM, miamia wrote: > Hello, > > on 32-bit windows everything works ok but on 64-bit win I am getting > this error: > Traceback (most recent call last): > File "app.py", line 1040, in do_this_now > File "kinterbasdb\__init__.pyc", line 119, in > File "kinterbasdb\_kinterba

Re: Does hashlib support a file mode?

2011-07-05 Thread Thomas Rachel
in.close() # generate EOF sum = sp.stdout.read() sp.wait() ? Does hashlib have a file-ready mode, to hide the streaming inside some clever DMA operations? AFAIK not. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: web browsing short cut

2011-07-06 Thread Thomas Jollans
On 07/06/2011 03:30 AM, Dustin Cheung wrote: > I am looking into Tkinter. But i am not sure if it will actually work. > This maybe a crazy idea but i was wondering if i can put a web browser > in the frame. I have tried to use Tkinter to resize and place the > windows to certain areas of the screen

Re: Python Packaging

2011-07-06 Thread Thomas Jollans
On 07/06/2011 11:44 AM, Benji Benjokal wrote: > > Can someone show me how to package with py2exe? > Every time I tried it says the file does not exist. If you show us how you're trying to do it, somebody may be able to spot your error. PS: http://www.catb.org/~esr/faqs/smart-questions.html --

Re: Python-list Digest, Vol 94, Issue 52

2011-07-08 Thread Thomas Jollans
se subscribe to the actual list, not the digest. Have fun Thomas > > Regards > mapere > > I'v > On 7/8/11, python-list-requ...@python.org > wrote: >> Send Python-list mailing list submissions to >> python-list@python.org >> >> To subscri

Re: Finding duplicated photo

2011-07-08 Thread Thomas Jollans
On 07/08/2011 01:29 PM, TheSaint wrote: > Hello, > > I came across the problem that Gwenview moves the photo from the camera > memory by renaming them, but later I forgot which where moved. > Then I tought about a small script in python, but I stumbled upon my > ignorance on the way to do that.

Re: Function docstring as a local variable

2011-07-10 Thread Richard Thomas
> >>> def findself(): > >         """Find myself. Ooh look, there I am!""" >         import sys >         try: >                 1/0 >         except: >                 traceback=sys.exc_info()[2] >         # Now I'm not sure what to do with traceback. >         # traceback.tb_frame.f_code.co_name

Re: A beginning programmer

2011-07-10 Thread Thomas Jollans
ct to have a go at. I don't know how familiar you are with C (as opposed to C++), but a large part of the code is written in Python, there's loads of activity on the bug tracker, and, in my experience, the community is very happy to help along new people contributing their first patch. Ch

Re: A beginning programmer

2011-07-10 Thread Thomas Jollans
On 07/11/2011 12:22 AM, Thomas Jollans wrote: > On 07/11/2011 12:06 AM, Eric wrote: >> My problem is this though... I don't know what to do with this new >> found knowledge of these languages. I'm a linux user so availability >> of development tools is haaardly a

Re: parsing packets

2011-07-11 Thread Thomas Rachel
ith len(), how else? > I'm also looking to build a packet and send it back out, is there something that will allow me to designate two bytes, set individual bits, then put it altogether in a packet to be sent out? The same: with struct.pack(). Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Thomas Jollans
On 07/11/2011 03:51 PM, Anthony Kong wrote: > Hi, all, > > Lately I am giving some presentations to my colleagues about the python > language. A new internal project is coming up which will require the use > of python. > > One of my colleague asked an interesting: > > /If Python use indentation

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Thomas Jollans
On 07/11/2011 04:36 PM, Dave Angel wrote: > The character you're asking about is the colon. It goes at the end of > an if, else, for, with, while statement. I doubt it's absolutely > essential, but it helps readability, since a conditional expression > might span multiple lines. > if some

Re: My take on 'Python Productivity tip for Java Programmer'. Could you give me more feedback?

2011-07-11 Thread Thomas Jollans
On 07/11/2011 05:07 PM, Anthony Kong wrote: > Hi, all, > > Lately I am giving some presentations to my colleagues about the python > language. A new internal project is coming up which will require the use > of python. > > One of the goals of the presentations, as told by the 'sponsor' of the > p

Re: Property setter and lambda question

2011-07-11 Thread Thomas Jollans
On 07/11/2011 05:54 PM, Anthony Kong wrote: > Hi, all, > > This question is in the same context of my two earlier questions. This > question was raised by some python beginners, and I would like to check > with the list to ensure I provide a correct answer. > > Here is a code snippet I used to de

Re: My take on 'Python Productivity tip for Java Programmer'. Could you give me more feedback?

2011-07-11 Thread Thomas Jollans
On 07/11/2011 06:42 PM, Anthony Kong wrote: > Thomas, > > Thanks for the excellent suggestions. > > Generator is certainly an interesting subject. > > From what i understand, the advantage of generator is mainly about > saving memory, right? (i.e. no need to create

Re: Property setter and lambda question

2011-07-11 Thread Thomas Jollans
def _(self): return self.__not_here not_here = property(_) del _ def _(self, val): self.__not_here = val not_here = not_here.setter(_) del _ """ @not_here.setter exists because not_here.setter exists. not_here exists since we set it (when the gett

Re: How to write a file generator

2011-07-12 Thread Thomas Jollans
On 07/12/2011 04:46 PM, Billy Mays wrote: > I want to make a generator that will return lines from the tail of > /var/log/syslog if there are any, but my function is reopening the file > each call: > > def getLines(): > with open('/var/log/syslog', 'rb') as f: > while True: >

Re: How to write a file generator

2011-07-12 Thread Thomas Jollans
On 07/12/2011 06:42 PM, Billy Mays wrote: > On 07/12/2011 11:52 AM, Thomas Jollans wrote: >> On 07/12/2011 04:46 PM, Billy Mays wrote: >>> I want to make a generator that will return lines from the tail of >>> /var/log/syslog if there are any, but my function is reope

Re: How to write a file generator

2011-07-12 Thread Thomas Jollans
On 07/12/2011 06:42 PM, Billy Mays wrote: > On 07/12/2011 11:52 AM, Thomas Jollans wrote: >> On 07/12/2011 04:46 PM, Billy Mays wrote: >>> I want to make a generator that will return lines from the tail of >>> /var/log/syslog if there are any, but my function is reope

Re: How to write a file generator

2011-07-12 Thread Thomas Rachel
: for i in f: print i, print "foo" import time time.sleep(4) Here, you iterate over the object until it is exhausted, but you can iterate again to get the next entries. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Code hosting services

2011-07-13 Thread Thomas Rachel
Am 13.07.2011 08:54 schrieb Andrew Berg: BTW, I'll likely be sticking with Mercurial for revision control. TortoiseHg is a wonderful tool set and I managed to get MercurialEclipse working well. In this case, I would recommend bitbucket. Thomas -- http://mail.python.org/mailman/lis

Re: Code hosting services

2011-07-13 Thread Thomas Jollans
On 07/13/2011 08:54 AM, Andrew Berg wrote: > I know this isn't specific to Python, but it is somewhat on topic. Way > back when I had a simple project, SourceForge was by far the most > prominent place to host (and it still is, though to a lesser extent > now). SourceForge is still an option for me

Re: Code hosting services

2011-07-13 Thread Thomas Jollans
On 07/13/2011 12:23 PM, Andrew Berg wrote: > On 2011.07.13 05:05 AM, Thomas Jollans wrote: >> There are a load of older sites, SourceForge, Savannah, Gna!, etc >> etc etc, but they don't support VCS other than CVS/Svn for the most >> part. > Many do support Mercurial

Re: Code hosting services

2011-07-13 Thread Thomas Jollans
On 07/13/2011 12:34 PM, Thomas Jollans wrote: > It does for Google Plus. Code. Code, not plus. Not concentrating. Argh. -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible File iteration bug

2011-07-15 Thread Thomas Rachel
Am 14.07.2011 21:46 schrieb Billy Mays: I noticed that if a file is being continuously written to, the file generator does not notice it: Yes. That's why there were alternative suggestions in your last thread "How to write a file generator". To repeat mine: an object which is not an iterator

Re: Possible File iteration bug

2011-07-15 Thread Thomas Rachel
thrown causes the generator to stop. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible File iteration bug

2011-07-15 Thread Thomas Rachel
ndicates to the looping header that there is no more data for now. a None or other sentinel value would do this as well (as ChrisA already said). Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible File iteration bug

2011-07-15 Thread Thomas Rachel
try: for i in f: print "", i, except NotNow, e: print "" time.sleep(1) HTH, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a Programming FAQ for Python 3.x?

2011-07-15 Thread Thomas Jollans
On 07/16/2011 01:24 AM, Richard D. Moores wrote: > Is there a Programming FAQ for Python 3.x? There is > , but it's for 2.7 > > Thanks, > > Dick Moores http://docs.python.org/py3k/faq/index.html http://docs.python.org/py3k/faq/programming.html -- htt

Re: Code hosting services

2011-07-16 Thread Thomas Jollans
On 07/16/2011 10:32 AM, Andrew Berg wrote: > Does anyone know if there are any services that have cross-project > integration? I can see myself closing a ton of bug reports just because > they are issues with the library part of the program, which will be a > separate project (because there will be

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Thomas Jollans
On 07/16/2011 06:31 PM, Phlip wrote: > Yes, pythonistas, sometimes I even amaze myself with the quality of > question that a computer scientist with a 25 year resume can ask > around here... > > In my defense, a Google search containing "intranet host" will fan out > all over the place, not narrow

Re: Code hosting services

2011-07-16 Thread Thomas Jollans
On 07/16/2011 06:00 PM, Jason Earl wrote: > On Sat, Jul 16 2011, Thomas Jollans wrote: > >> On 07/16/2011 10:32 AM, Andrew Berg wrote: >>> Does anyone know if there are any services that have cross-project >>> integration? I can see myself closing a ton of bug rep

Re: Possible File iteration bug

2011-07-17 Thread Thomas Rachel
n starting over. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Code hosting services

2011-07-17 Thread Thomas Jollans
On 07/17/2011 12:08 PM, Ben Finney wrote: > Thomas Jollans writes: > >> Launchpad has a cross-project bug tracker. > > With which you can (so I'm told) interact with completely using email. > >> Launchpad also uses the excruciatingly slow (but distributed, a

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas Jollans
On Jul 17, 9:47 am, Xah Lee wrote: > 2011-07-16 > > folks, this one will be interesting one. > > the problem is to write a script that can check a dir of text files > (and all subdirs) and reports if a file has any mismatched matching > brackets. > > • The files will be utf-8 encoded (unix style l

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas Boell
On Sun, 17 Jul 2011 02:48:42 -0700 (PDT) Raymond Hettinger wrote: > On Jul 17, 12:47 am, Xah Lee wrote: > > i hope you'll participate. Just post solution here. Thanks. > > http://pastebin.com/7hU20NNL I'm new to Python. I think I'd have done it in a similar way (in any language). Your use of o

Re: a little parsing challenge ☺

2011-07-17 Thread Thomas Jollans
On 07/17/2011 10:16 PM, Thomas 'PointedEars' Lahn wrote: > Raymond Hettinger wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Did you notice the excessive crosspost? Please do not feed the troll. >> >> IMO, this was a legitimate cross

<    1   2   3   4   5   6   7   8   9   10   >