Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Ulrich Eckhardt
Am 21.11.2012 02:43, schrieb Steven D'Aprano: On Tue, 20 Nov 2012 20:07:54 +, Robert Kern wrote: The source of bugs is not excessive complexity in a method, just excessive lines of code. Taken literally, that cannot possibly the case. def method(self, a, b, c): do_this(a) do_tha

Re: How to create an executable from python script in windows

2012-11-28 Thread Ulrich Eckhardt
Am 28.11.2012 07:43, schrieb Prakash: copying C:\Python24\lib\site-packages\py2exe\run_w.exe Python 2.4 was released 8 years ago and shouldn't be used for new development or learning any longer. The first step I would take is to upgrade to 2.7, which is the last in the 2

Re: amazing scope?

2012-11-30 Thread Ulrich Eckhardt
Am 30.11.2012 12:11, schrieb andrea crotti: I wrote a script, refactored it and then introducing a bug as below: def record_things(): out.write("Hello world") This is a function. Since "out" is not a local variable, it is looked up in the surrounding namespace at the time the function is

Re: Error .. Please Help

2012-12-12 Thread Ulrich Eckhardt
Am 12.12.2012 16:00, schrieb inshu chauhan: color = image[y,x] if color == (0.0,0.0,0.0): continue else : if color == (0.0,255.0,0.0): classification = 1 elif color == (128.0, 0.0, 255.0): classifi

Re: Problem with calling function from dll

2012-12-13 Thread Ulrich Eckhardt
Am 13.12.2012 08:40, schrieb deep...@poczta.fm: I have problem with using function from dll. import ctypes b = ctypes.windll.LoadLibrary("kernel32") a = "" b.GetComputerNameA(a,20) GetComputerNameA takes a pointer to a writable char string. You give it a pointer to an immutable string. You

Re: new to python and programming at large

2013-01-09 Thread Ulrich Eckhardt
Am 09.01.2013 22:05, schrieb kwakukwat...@gmail.com: pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. Whenever describing an error, be precise. In this particular case, we have some sourcecode (which is good!) but what is still missin

Re: unit selection problem

2013-01-15 Thread Ulrich Eckhardt
Am 14.01.2013 21:29, schrieb Paul Pittlerson: map_textures = get_sprites( (48, 48) ,"spritesheet.png" , (0, 0) ) You forgot to include spritesheet.png in your message. Seriously, condense your code down to a minimal example. This might help you finding the problem yourself, otherwise

Re: interrupt the file sending if the file size over the quota...some errors here...

2013-01-15 Thread Ulrich Eckhardt
Am 15.01.2013 10:46, schrieb Levi Nie: i want to interrupt the file sending. but i can't change the client. so i need change the server. All things go well, but the message i wanna response seem not work. Ahem, what? It doesn't work, so does it sit on the couch all day? is the self.transport

Re: need explanation

2013-01-21 Thread Ulrich Eckhardt
Am 21.01.2013 17:06, schrieb kwakukwat...@gmail.com: please I need some explanation on sys.stdin and sys.stdout, and piping out http://www.catb.org/esr/faqs/smart-questions.html Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory error with quadratic interpolation

2013-01-23 Thread Ulrich Eckhardt
Am 23.01.2013 05:06, schrieb Isaac Won: I have tried to use different interpolation methods with Scipy. My code seems just fine with linear interpolation, but shows memory error with quadratic. I am a novice for python. I will appreciate any help. > #code f = open(filin, "r") Check out the "w

Re: monolithic apps

2013-01-24 Thread Ulrich Eckhardt
Am 24.01.2013 18:06, schrieb tamn...@gmail.com: Any suggestions for study?..: Is is possible to take a large executable with GUI and real time data and images, to extract modules, and it can run as if it looks like a monolithic application (windows over main windows, or images over other images)

Re: Parsing a serial stream too slowly

2012-01-24 Thread Ulrich Eckhardt
Am 23.01.2012 22:48, schrieb M.Pekala: I think that regex is too slow for this operation, but I'm uncertain of another method in python that could be faster. A little help would be appreciated. Regardless of the outcome here, I would say that your code is still a bit wonky on the handling of p

Re: xhtml encoding question

2012-02-01 Thread Ulrich Eckhardt
Am 31.01.2012 19:09, schrieb Tim Arnold: high_chars = { 0x2014:'—', # 'EM DASH', 0x2013:'–', # 'EN DASH', 0x0160:'Š',# 'LATIN CAPITAL LETTER S WITH CARON', 0x201d:'”', # 'RIGHT DOUBLE QUOTATION MARK', 0x201c:'“', # 'LEFT DOUBLE QUOTATION MARK', 0x2019:"’", # 'RIGHT SINGLE

Re: xhtml encoding question

2012-02-01 Thread Ulrich Eckhardt
Am 01.02.2012 10:32, schrieb Peter Otten: It doesn't matter for the OP (see Stefan Behnel's post), but If you want to replace characters in a unicode string the best way is probably the translate() method: print u"\xa9\u2122" ©™ u"\xa9\u2122".translate({0xa9: u"©", 0x2122: u"™"}) u'©™' Ye

Re: xhtml encoding question

2012-02-02 Thread Ulrich Eckhardt
Am 02.02.2012 12:02, schrieb Peter Otten: Ulrich Eckhardt wrote: >>> u'abc'.translate({u'a': u'A'}) u'abc' I would call this a chance to improve Python. According to the documentation, using a string [as key] is invalid, but it neither r

Re: difference between random module in python 2.6 and 3.2?

2012-02-07 Thread Ulrich Eckhardt
Am 06.02.2012 09:45, schrieb Matej Cepl: Also, how could I write a re-implementation of random.choice which would work same on python 2.6 and python 3.2? It is not only matter of unit tests, but I would really welcome if the results on both versions produce the same results. Two approaches come

Re: Automatic Type Conversion to String

2012-02-14 Thread Ulrich Eckhardt
Am 14.02.2012 00:18, schrieb Bruce Eckel: I'm willing to subclass str, but when I tried it before it became a little confusing -- I think mostly because anytime I assigned to self it seemed like it converted the whole object to a str rather than a Path. I suspect I don't know the proper idiom for

Re: name of a sorting algorithm

2012-02-14 Thread Ulrich Eckhardt
Am 14.02.2012 16:01, schrieb Jabba Laci: Could someone please tell me what the following sorting algorithm is called? Let an array contain the elements a_1, a_2, ..., a_N. Then: for i = 1 to N-1: for j = i+1 to N: if a_j< a_i then swap(a_j, a_i) It's so simple that it's not ment

Re: format a measurement result and its error in "scientific" way

2012-02-17 Thread Ulrich Eckhardt
Am 16.02.2012 01:18, schrieb Daniel Fetchinson: Hi folks, often times in science one expresses a value (say 1.03789291) and its error (say 0.00089) in a short way by parentheses like so: 1.0379(9) Just so that I understand you, the value of the last "digit" is somewhere between 9-9 and 9+9, ri

building GNU debugger (was: Re: Python-list Digest, Vol 101, Issue 164)

2012-02-29 Thread Ulrich Eckhardt
Three things up front: 1. Do not reply to digests. If you want to only read, you can use the digests, but they are not usable for replying, because it is completely unclear where in a discussion you are entering and what you are relating your answers to. 2. Do not start new threads by using the re

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-14 Thread Ulrich Eckhardt
Am 13.03.2012 22:08, schrieb Roy Smith: Using argparse, if I write: parser.add_argument('--foo', default=100) it seems like it should be able to intuit that the type of foo should be int (i.e. type(default)) without my having to write: parser.add_argument('--foo', type=int, default=1

unittest: assertRaises() with an instance instead of a type

2012-03-28 Thread Ulrich Eckhardt
Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try: foo() self.fail('exception not raised') catch MyException as e: self

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:07, schrieb Steven D'Aprano: First off, that is not Python code. "catch Exception" gives a syntax error. Old C++ habits... :| Secondly, that is not the right way to do this unit test. You are testing two distinct things, so you should write it as two separate tests: [..code

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: with self.assertRaises(MyException(SOME_FOO_ERROR)): foo() I presume that if this worked the way you want, all attributes would have to match. The message part of builtin exceptions is allowed to change

tabs/spaces (was: Re: unittest: assertRaises() with an instance instead of a type)

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: [...] # call testee and verify results try: ...call function here... except exception_type as e: if not exception is None: self.assertEqual(e, exception) Did you use tabs? They do not get preserved

Re: tabs/spaces

2012-03-30 Thread Ulrich Eckhardt
Am 29.03.2012 17:25, schrieb Terry Reedy: I am using Thunderbird, win64, as news client for gmane. The post looked fine as originally received. The indents only disappeared when I hit reply and the >s were added. I can confirm this misbehaviour of Thunderbird (version 11.0 here), it strips the

Re: tabs/spaces

2012-04-02 Thread Ulrich Eckhardt
Am 30.03.2012 14:47, schrieb Dave Angel: > But since it doesn't do it on all messages, have you also confirmed that > it does it for a text message? My experience seems to be that only the > html messages are messed up that way. I can't find any HTML in what I posted, so HTML is not the problem.

Re: functions which take functions

2012-04-10 Thread Ulrich Eckhardt
Am 09.04.2012 20:57, schrieb Kiuhnm: > Do you have some real or realistic (but easy and self-contained) > examples when you had to define a (multi-statement) function and pass it > to another function? Take a look at decorators, they not only take non-trivial functions but also return them. That s

docstrings for data fields

2012-05-03 Thread Ulrich Eckhardt
Hi! My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with functions I would simply add a docstring explaining the meaning of this, but how do I do that for a non-function member? Note also that ideally, this constant wouldn't show up inside instances of the class but only inside

Re: How to get outer class name from an inner class?

2012-05-09 Thread Ulrich Eckhardt
Am 08.05.2012 22:05, schrieb John Gordon: [...] > class QuestionTooShortError(ApplicationException): > """User entered a security question which is too short.""" > pass > > class QuestionTooLongError(ApplicationException): > """User entered a security question which is too long.""" >

Re: Question of Python second loop break and indexes

2012-05-09 Thread Ulrich Eckhardt
Am 09.05.2012 10:36, schrieb lilin Yi: > //final_1 is a list of Identifier which I need to find corresponding > files(four lines) in x(x is the file) and write following four lines > in a new file. > > //because the order of the identifier is the same, so after I find the > same identifier in x ,

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Ulrich Eckhardt
Marco wrote: > >>> '123'.isdecimal(), '123'.isdigit() > (True, True) > >>> print('\u0660123') > ٠123 > >>> '\u0660123'.isdigit(), '\u0660123'.isdecimal() > (True, True) > >>> print('\u216B') > Ⅻ > >>> '\u216B'.isdecimal(), '\u216B'.isdigit() > (False, False) [chr(a) for a in range(0x2) if

Re: Python Book for a C Programmer?

2012-05-24 Thread Ulrich Eckhardt
Am 24.05.2012 01:45, schrieb hsa...@gmail.com: > I am trying to join an online class that uses python. I need to brush > up on the language quickly. Is there a good book or resource that > covers it well but does not have to explain what an if..then..else > statement is? First thing to check first

Re: Korean fonts on Python 2.6 (MacOsX)

2012-05-24 Thread Ulrich Eckhardt
Am 23.05.2012 11:30, schrieb 20_feet_tall: > I have a problem with the visualization of korean fonts on Python. > When I try to type in the characters only squares come out. > I have tried to install the CJK codec, the hangul 1.0 codec but still > no result. What exactly do you mean with "visualiz

installing 2 and 3 alongside on MS Windows

2012-05-25 Thread Ulrich Eckhardt
Hi! I'm using Python 2.7 for mostly unit testing here. I'm using Boost.Python to wrap C++ code into a module, in another place I'm also embedding Python as interpreter into a test framework. This is the stuff that must work, it's important for production use. I'm running MS Windows XP here and dev

Re: Python 2.7.3, C++ embed memory leak?

2012-05-29 Thread Ulrich Eckhardt
Am 29.05.2012 16:37, schrieb Qi: > I tried to only call Py_Initialize() and Py_Finalize(), nothing else > between those functions, Valgrind still reports memory leaks > on Ubuntu? Call the pair of functions twice, if the reported memory leak doesn't increase, there is no problem. I personally woul

Re: How to suppress exception printing to console?

2012-05-31 Thread Ulrich Eckhardt
Am 31.05.2012 09:57, schrieb Qi: > I have an application that embedding Python into C++. > When any exception occurred in C++ code, PyErr_SetString will > be called to propagate the exception to Python. The first sentence is clear. The second sentence rather sounds as if you were implementing a Py

Re: How to suppress exception printing to console?

2012-06-01 Thread Ulrich Eckhardt
Am 01.06.2012 05:06, schrieb Qi: > On 2012-5-31 23:01, Ulrich Eckhardt wrote: >> I can only guess what you are doing, maybe you should provide a simple >> piece of code (or, rather, one C++ piece and a Python piece) that >> demonstrates the issue. What I could imagi

Re: fputs

2012-06-05 Thread Ulrich Eckhardt
Am 05.06.2012 15:54, schrieb hassan: > what is the equivalent to the php fputs in python If that fputs() is the same as C's fputs(), then write() is pretty similar. Check the documentation for files, you will surely find the equivalent. Uli -- http://mail.python.org/mailman/listinfo/python-lis

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Ulrich Eckhardt
Am 05.06.2012 19:32, schrieb Laurent Pointal: > I started a first translation of my document originally in french. Could > some fluent english people read it and indicate errors or bad english > expressions. Just one note up front: Languages or nationalities are written with uppercase letters, l

Re: Why does this leak memory?

2012-06-11 Thread Ulrich Eckhardt
Am 08.06.2012 18:02, schrieb Steve: > Well, I guess I was confused by the terminology. I thought there were > leaked objects _after_ a garbage collection had been run (as it said > "collecting generation 2"). Also, "unreachable" actually appears to mean > "unreferenced". You live n learn... Actual

Re: post init call

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 09:10, schrieb Prashant: > class Shape(object): > def __init__(self, shapename): > self.shapename = shapename > > > def update(self): > print "update" > > class ColoredShape(Shape): > def __init__(self, color): > Shape.__init__(se

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 16:00, schrieb jmfauth: > A string is a string, a "piece of text", period. No. There are different representations for the same piece of text even in the context of just Python. b'fou', u'fou', 'fou' are three different source code representations, resulting in two different runtime

Re: basic bytecode to machine code compiler (part 3)

2011-06-21 Thread Ulrich Eckhardt
Rouslan Korneychuk wrote: > if i != pindex: > (less if x <= pivot else greater).append(x) Just curious, is there a reason why you wrote this last line that way instead of using a "normal" if/else clause? Cheers! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Ham

Re: Change the name with the random names in a text file

2011-06-29 Thread Ulrich Eckhardt
Amaninder Singh wrote: > I am fairly new to the language and programing. I am trying to solve a > problem in a text file. Where names are something like in this manner > [**Name2 (NI) 98**] > > [**Last Name (STitle) 97**] > [**First Name4 (NamePattern1) 93**] > [**Last Name (NamePattern1) 94**]

Re: using an instance of Object as an empty class

2011-06-29 Thread Ulrich Eckhardt
Peter Otten wrote: > Examples for classes that don't accept attributes are builtins > like int, tuple, and -- obviously -- dict. You can make your own > using the __slot__ mechanism: > class A(object): > ... __slots__ = ["x", "y"] > ... a = A() a.x = 42 a.y = "yadda" a

Re: using an instance of Object as an empty class

2011-06-30 Thread Ulrich Eckhardt
Peter Otten wrote: > collections.namedtuple is a convenient struct replacement -- if you don't > mind that it is immutable. Thanks you and also Steven for mentioning this, it is an even better replacement for what I had in mind! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsg

Re: how to call a function for evry 10 secs

2011-06-30 Thread Ulrich Eckhardt
Dennis Lee Bieber wrote: > But if the function itself runs for longer than 10 seconds, there > will be a major problem, as the sleep apparently takes the argument as > unsigned, and a negative number is a very big sleep! "time.sleep()" takes a floating point number, so an underflow like for fixed

Re: how to call a function for evry 10 secs

2011-06-30 Thread Ulrich Eckhardt
Dennis Lee Bieber wrote: > And that was a direct cut&paste from a command window; showing it > had slept for some 90 seconds before I killed it. Interesting. Just tried a 2.7.2 on a 32-bit MS Windows with following results: 1. sleep(5 - 2**32) sleeps for a few seconds 2. sleep(-1) sleeps much lo

Re: how to call a function for evry 10 secs

2011-07-01 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: > I'll take this to the developers mailinglist and see if they > consider the behaviour a bug. Filed as bug #12459. Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list

embedding: how do I redirect print output?

2011-07-05 Thread Ulrich Eckhardt
Hi! 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 output to a log window, right. However, I'm using

Re: embedding: how do I redirect print output?

2011-07-06 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > Why do you think it [sink for use as sys.stdout] needs to be in C? As > far as I can tell, so long as it quacks like a file object (that is, > has a write method), it should work. Good point & thanks for the example fish! Uli -- Domino Laser GmbH Geschäftsführer: Thors

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
rantingrick wrote: > On Jul 5, 10:26 am, Steven D'Aprano > Since you can't do anything without a root window, I don't see the >> benefit in forcing the user to do so [create one explicitly]. > > The reason is simple. It's called order. It's called learning from day > one how the order of things ex

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
Mel wrote: > In wx, many of the window classes have Create methods, for filling in > various attributes in "two-step construction". I'm not sure why, because > it works so well to just supply all the details when the class is called > and an instance is constructed. Maybe there's some C++ strateg

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Ulrich Eckhardt
Rama Rao Polneni wrote: > After storing 1.99 GB data in to the dictionary, python stopped to > store the remaining data in to dictionary. Question here: - Which Python? - "stopped to store" (you mean "stopped storing", btw), how does it behave? Hang? Throw exceptions? Crash right away? > Memo

Re: Implicit initialization is EXCELLENT

2011-07-07 Thread Ulrich Eckhardt
Ian Kelly wrote: > On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt > wrote: >> Mel wrote: >>> In wx, many of the window classes have Create methods, for filling in >>> various attributes in "two-step construction". [...] >> >> Just guessing, is

Re: Large number multiplication

2011-07-07 Thread Ulrich Eckhardt
Billy Mays wrote: > On 07/06/2011 04:02 PM, Ian Kelly wrote: >> According to Wikipedia: >> >> """ >> In practice the Schönhage–Strassen algorithm starts to outperform >> older methods such as Karatsuba and Toom–Cook multiplication for >> numbers beyond 2**2**15 to 2**2**17 (10,000 to 40,000 decimal

Re: Strings show as brackets with a 'u'.

2011-07-25 Thread Ulrich Eckhardt
Chris Angelico wrote: > On Sun, Jul 24, 2011 at 10:33 AM, goldtech wrote: >> >> I'm using using Idle on winXP, activestate 2.7. Is there a way to >> suppress this and just show 174 in the shell ? >> A script reading data and assigns 174 to n via some regex. Links on >> this appreciated - I've tri

Re: monotonically increasing memory usage

2011-07-29 Thread Ulrich Eckhardt
Pedro Larroy wrote: > Just crossposting this from stackoverflow: > > http://stackoverflow.com/... > > Any hints? At first I was just too lazy to visit stackoverflow and skipped this posting. Then I thought: Why didn't you include the content, so people can actually answer this question here? T

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-01 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > jc wrote: >> n = 900 >> cache = range(0 , n + 1 , 1) >> for i in cache: >> cache[i] = -1 > > This is a waste of time. Better to write: > > cache = [-1]*900 Since he's computing the Fibonacci number of n, and n is 900, he needs cache = [-1] * (n + 1)

Re: python import error, what's wrong?

2011-08-03 Thread Ulrich Eckhardt
smith jack wrote: > I am using pydev plugin in eclipse, all things works just as well > but now i have confronted with a confusing problem, that is i can > import a module write by myself successfully, but when i try to run > this program, > error just shows up, what's wrong? > > the directory str

Re: Segmentation Fault on exit

2011-08-08 Thread Ulrich Eckhardt
Vipul Raheja wrote: > I have wrapped a library from C++ to Python using SWIG. But when I > import it in Python, I am able to work fine with it, but it gives a > segmentation fault while exiting. 1. Use a debugger Run python with "gdb python", import the module and exit. The debugger should then s

Re: How to solve this problem

2011-08-09 Thread Ulrich Eckhardt
Johny wrote: > I have a client that is a part of a local network.This client has a > local address( not public).Is there a way how I can connect to this > client from outside world? > What software must I install so that I can connect and control that > client from outside? How is that a Python p

Re: indentation

2011-08-11 Thread Ulrich Eckhardt
Amit Jaluf wrote: > which book or tutorial i should for it(Python) > i found "A Byte of Python " by Swaroop > after that which tutorial(book) i have to read You can read lots of book reviews online. That said, have you checked http://www.python.org? Uli -- Domino Laser GmbH Geschäftsführer: Th

Re: write()

2011-08-22 Thread Ulrich Eckhardt
Hyun-su wrote: > I have a file which is 3D data ([pixel_x, pixel_y, pixel_z]) > > I want to plot and write into other file as 1 dimension ([:, y_cut, > z_cut]) > > How can I do it? I'd write a loop along these lines: with open(outputfile, 'w') as o: for pixel_x, pixel_y, pixel_z in inpu

Re: is there any principle when writing python function

2011-08-23 Thread Ulrich Eckhardt
smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? Don't compromise the desig

Re: Finding keywords

2011-03-08 Thread Ulrich Eckhardt
Cross wrote: > On 03/08/2011 01:27 PM, Chris Rebert wrote: > Well Chris, my implementation is in Python. :) That is as much > python-specific as it gets. > > Well the question is general of course and I want to discuss the problem > here. If you have anything written in Python yet and want to pre

Re: Switching between Python releases under Windows

2011-03-08 Thread Ulrich Eckhardt
Edward Diener wrote: > I have multiple versions of Python installed under Vista. Is there any > easy way of switching between them so that invoking python and file > associations for Python extensions files work automatically ? These associations are stored in the registry. Just cut out the accord

Re: Dijkstra Algorithm Help

2011-03-09 Thread Ulrich Eckhardt
yoro wrote: > Thanks for replying, maybe i'm misunderstanding your comment - > nodeTable is used to store the distances from source of each node > within a text file, the file having the format : > > 1,2,3,4,5,6,7,8,9 > 1,2,3,4,5,6,7,8,9 > > Each of these nodes will have the same settings as set

Re: Get Path of current Script

2011-03-14 Thread Ulrich Eckhardt
Alexander Schatten wrote: > Thanks for the comments so far. This sounds to be more complicated in > detail than I expected. I wonder how all the other Python programs and > scripts are doing that... Well, it's not like that's impossible to find out, the source is out there! :) Anyhow, you basical

Re: alphanumeric list

2011-03-15 Thread Ulrich Eckhardt
yqyq22 wrote: > I would like to put an alphanumeric string like this one > EE472A86441AF2E629DE360 in a list, then iterate inside the entire > string lenght and change each digit with a random digit. What does "change each digit with a random digit"? Do you want to swap two random elements of the

Re: alphanumeric list

2011-03-15 Thread Ulrich Eckhardt
yqyq22 wrote: > Hi, to be honest i'm a newbye so i don't know where to start, i began > in this way but i don't know how to proceeed. > list = (EE472A86441AF2E629DE360) "list" is a builtin type, so you shouldn't use it as name for other things. The thing on the right-hand side of the assignment is

Re: python time

2011-03-21 Thread Ulrich Eckhardt
ecu_jon wrote: > import time,os,string,getpass,md5,ConfigParser > from time import strftime,localtime You are importing the time module first, then import some symbols from the time module. This seems redundant to me. Note that after the "import time", the name "time" refers to the module you i

codec for UTF-8 with BOM

2011-05-02 Thread Ulrich Eckhardt
Hi! I want to write a file starting with the BOM and using UTF-8, and stumbled across some problems: 1. I would have expected one of the codecs to be 'UTF-8 with BOM' or something like that, but I can't find the correct name. Also, I can't find a way to get a list of the supported codecs at al

Re: codec for UTF-8 with BOM

2011-05-02 Thread Ulrich Eckhardt
Chris Rebert wrote: >> 3. The docs mention encodings.utf_8_sig, available since 2.5, but I can't >> locate that thing there either. What's going on here? > > Works for me™: > Python 2.6.6 (r266:84292, Jan 12 2011, 13:35:00) > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin > Type "help", "copyright"

Re: HI

2011-05-02 Thread Ulrich Eckhardt
anvar wrote: > Could you please help me with the modeling in Python the following > problem: (e.g., g_t means g with index t) Typically, you would use either a list or a dict to simulate something like that: # list g = [1, 2, 4, 8, 16] print g[3] # dictionary h = {} h[0] = 1 h[1]

Re: Parsing a graph image

2011-05-13 Thread Ulrich Eckhardt
Bastian Ballmann wrote: > I am searching for a library to parse data from a graph in an image file > something like http://pytseries.sourceforge.net/_images/yahoo.png > Any suggestions, hints, links? I'm not sure I understand 100% what you want. If you want to extract ("parse") the data that is c

Re: hash values and equality

2011-05-20 Thread Ulrich Eckhardt
Ethan Furman wrote: > Several folk have said that objects that compare equal must hash equal, > and the docs also state this > http://docs.python.org/dev/reference/datamodel.html#object.__hash__ > > I'm hoping somebody can tell me what horrible thing will happen if this > isn't the case? If you w

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Ulrich Eckhardt
Octavian Rasnita wrote: > Somebody told that C# and Objective C are good languages. They might be > good, but they are proprietary, and not only that they are proprietary, > but they need to be ran under platforms that cannot be used freely, so > from the freedom point of view, Perl, Ruby, Python a

Re: Obtaining a full path name from file

2011-05-25 Thread Ulrich Eckhardt
RVince wrote: > s = "C:\AciiCsv\Gravity_Test_data\A.csv" > f = open(s,"r") > > How do I obtain the full pathname given the File, f? Apart from the issue that the 'name' attribute is only the name used to open the file, there is another issue, though not on the platform you're using: Multiple di

Re: Code Review

2011-05-25 Thread Ulrich Eckhardt
ad wrote: > Please review the code pasted below. I am wondering what other ways > there are of performing the same tasks. On a unix system, you would call "find" with according arguments and then handle the found files with "-exec rm ..." or something like that, but I see you are on MS Windows.

Escape-Sequenzen in einem String identifizieren

2017-10-01 Thread Ulrich Goebel
herauszufinden, suche ich eine Funktion zeige_escape(string), die mir liefert: s = 'Hallo\nNeue Zeile' zeige_escape(s) Hallo\nNeue Zeile print hilft nicht, denn print(s) Hallo Neue Zeile Hat jemand eine Idee? Dank und Gruß Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bon

Function to call a extern command as a filter

2019-09-25 Thread Ulrich Goebel
read the outputfile into the string l return (l) What would be nice: I would like to avoid the extra steps writing an reading extern files. Can anybody help me? Thanks Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
session) File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) PermissionError: [Errno 13] Permission denied Using subprocess.call(['./', 'Test.py'], shell=True) I get Test.py: 1: Test.py: ./: Permission d

Re: os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
Sorry for the wrong spelling. In fact subprocess.call('./Test.py') works. The raising error was my error too, using ['./', 'Test.py'] instead of './Test.py' Sorry... Am 28.11.19 um 11:05 schrieb Ulrich Goebel: Hi, I have to call commands fro

strptime for different languages

2019-12-17 Thread Ulrich Goebel
e possible languages.) Best regards Ulrich -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
That's absolutely great, thank You! Am 17.12.19 um 11:53 schrieb Jon Ribbens via Python-list: On 2019-12-17, Ulrich Goebel wrote: I need to interpret a date string to get a datetime object. That should be done with strptime from the module datetime. But I don't know enough about

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
użytkownik Ulrich Goebel napisał: 13. Januar 1965 13. January 1965 13.01.1965 1965-01-13 02.03.2000 Is it Mar, 2nd 2000 or Feb, 3rd 2000? -- Ulrich Goebel Am Büchel 57, 53173 Bonn -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-01 Thread Ulrich Hobelmann
Paul F. Dietz wrote: > Bart Lateur wrote: > >> As a similar example: I've been told by various women independently, >> that "there are more babies born near a full moon." > > That's also a myth. Right, everybody knows that it's not natural (moon) light that influences reproductive behavior, it'

Re: check html file size

2005-10-05 Thread Ulrich Hobelmann
Richard Gration wrote: > Are you fucking seriously fucking expecting some fucking moron to > translate your tech geeking fucking code moronicity? Fucking try writing > it fucking properly in fucking Perl first. Fucking excuse me? Fucking maybe you should fucking go fucking fuck your fucking self.

Re: check html file size

2005-10-06 Thread Ulrich Hobelmann
Sherm Pendley wrote: > I'm guessing you didn't get the joke then. I think Richard's response was a > parody of Xah's "style" - a funny parody, at that. If you take all the line noise in Perl as swearing ;) I suppose I'm lucky I can't read it. -- We're glad that graduates already know Java, so we

Re: Perl-Python-a-Day: Sorting

2005-10-10 Thread Ulrich Hobelmann
Xah Lee wrote: > To sort a list in Python, use the “sort” method. For example: > > li=[1,9,2,3]; > li.sort(); > print li; Likewise in Common Lisp. In Scheme there are probably packages for that as well. My apologies for not being very fluent anymore. CL-USER> (setf list (sort '(1 9 2 3) #'<))

Re: Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-06 Thread Ulrich Hobelmann
Pascal Bourguignon wrote: > Do you have an "Approved by Xah Lee" seal logo they could put on their web > page? Funny, that'd *exactly* mirror the opinion I have of PHP :D (btw, why is this posted to every newsgroup EXCEPT a PHP one? make us feel good?) -- Majority, n.: That quality that dist

Re: Jargons of Info Tech industry

2005-08-12 Thread Ulrich Hobelmann
Jürgen Exner wrote: > Just for the records at Google et.al. in case someone stumbles across Xah's > masterpieces in the future: > Xah is very well known as the resident troll in many NGs and his > 'contributions' are less then useless. And you are the resident troll-reply service, posting this rep

Re: Jargons of Info Tech industry

2005-08-12 Thread Ulrich Hobelmann
jan V wrote: > Did you know that some deranged people take sexual pleasure out of starting > fires? Apparently some of the latest forest/bush fires in southern Europe > were even started by firemen (with their pants down?). I've only heard of people trying to extinguish fires with their pants dow

Re: Jargons of Info Tech industry

2005-08-22 Thread Ulrich Hobelmann
Keith Thompson wrote: > "Xah Lee" <[EMAIL PROTECTED]> writes: > [the usual] At least he noticed that tar sucks. There's nothing better than tarring your backup back to disk, only to notice that the pathnames were "too long." Great! -- I believe in Karma. That means I can do bad things to pe

Re: Jargons of Info Tech industry

2005-08-23 Thread Ulrich Hobelmann
l v wrote: > Xah Lee wrote: >> (circa 1996), and email should be text only (anti-MIME, circa 1995), > > I think e-mail should be text only. I have both my email and news > readers set to display in plain text only. It prevents the marketeers Be generous in what you accept and conservative in

Re: Jargons of Info Tech industry

2005-08-23 Thread Ulrich Hobelmann
Roger Leigh wrote: >> At least he noticed that tar sucks. There's nothing better than tarring >> your backup back to disk, only to notice that the pathnames were "too >> long." Great! > > That's been fixed for quite some time, though. The current GNU tar > (1.15.1) writes POSIX.1-2001 (PAX) a

Re: Jargons of Info Tech industry

2005-08-25 Thread Ulrich Hobelmann
[EMAIL PROTECTED] wrote: > In comp.lang.perl.misc John Bokma <[EMAIL PROTECTED]> wrote: >>> the argument that usenet should never change seems a little >>> heavy-handed and anachronistic. >> No, simple since there *are* alternatives: web based message boards. Those >> alternatives *do* support HTM

Re: Usenet, HTML (was Re: Jargons of Info Tech industry)

2005-08-26 Thread Ulrich Hobelmann
John Bokma wrote: > Ulrich Hobelmann <[EMAIL PROTECTED]> wrote: > >> On the information side (in contrast to the discussion side) RSS is >> replacing Usenet, > > LOL, how? I can't post to RSS feeds. Or do you mean for lurkers? I said "information s

<    1   2   3   4   5   >