pyserial: wait for execute

2016-10-15 Thread Michael Okuntsov

Hello,
is there a way, other than time.sleep(), to be sure that the command 
sent through a serial port has been fully executed? I'm interested 
specifically in SCPI commands in VA-meters such as Keithley and Tektronix.

Thanks.
--
https://mail.python.org/mailman/listinfo/python-list


[beginner] What's wrong?

2016-04-01 Thread Michael Okuntsov

Hello,
I have a Pascal code for some hash function. I've tried to rewrite it on 
Python but it doesn't give the right value (which is 32202). Please tell 
me where is the error.


Thanks.

**
Pascal program
**

Program K_S;
Var
  ST: String;
function KSUM(var S: String): String;
var
  i, l: Integer;
  KS: Word;
  SS: String;
begin
  KS:=65535;
  for i:=2 to Length(S) do
  begin
KS := KS xor Ord(S[i]);
writeln(S[i]);
for l:=1 to 8 do
 if (KS div 2)*2<>KS then KS := (KS div 2) xor 40961
 else KS := (KS div 2);
  end;
  Str(KS, SS);
  KSUM := SS;
end;


Begin
 ST := ':1;1;2;';
 Writeln(KSUM(ST));
End.


**
Python program
**

def myhash(s):
KS=65535
for i in range(1,len(s)):
KS=KS ^ ord(s[i])
for j in range(1,8):
if (KS // 2)*2 != KS:
KS=(KS // 2) ^ 40961
else:
KS=KS // 2
return(str(KS))
if __name__ ==  "__main__":
st=myhash(":1;1;2;")
print (st)
--
https://mail.python.org/mailman/listinfo/python-list


Re: [beginner] What's wrong?

2016-04-01 Thread Michael Okuntsov

Nevermind. for j in range(1,8) should be for j in range(8).
--
https://mail.python.org/mailman/listinfo/python-list


Re: [beginner] What's wrong?

2016-04-03 Thread Michael Okuntsov

03.04.2016 20:52, Rustom Mody пишет:


To really localize python one would have to
1. Localize the keywords
2. Localize all module names
3. Localize all the help strings
4. Localize the entire stuff up at https://docs.python.org/3/
5. ...

That is probably one or two orders of magnitude more work than
localizing gimp or Word

So if this is the full goal how far does
"You can now spell (or misspell) your python identifiers in any language of your 
choice"
go towards that goal?



As an OP, can I participate in the discussion? Here in Russia we have a 
monstrous bookkeeping system called 1C-Predpriyatiye that is used by 
almost all firms and organizations, from kiosks to huge factories. This 
system has a Basic-like language with keywords, module names etc. 
localized in Russian language, but it has also English, German, and 
Ukrainian localizations. I don't want to say that common programming 
languages should be like this, but here we have an example that it can 
be done.

--
https://mail.python.org/mailman/listinfo/python-list